Merge pull request #503 from mieweb/hotfix/id-parser #69
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prod Server Deploy | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo apt-get update | |
- run: sudo apt-get install -y libkrb5-dev | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install node_modules | |
run: npm install | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm run test | |
build: | |
needs: test | |
runs-on: wgd-prod | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Build action runner | |
run: docker build -t "wgd-action-runner:prod" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner | |
- name: Build hugo docs | |
run: | | |
docker run \ | |
-v "${GITHUB_WORKSPACE}/hugo:/site" \ | |
-v "${GITHUB_WORKSPACE}/website:/website" \ | |
-v "/var/www/wikigdrive.com:/dist/hugo" \ | |
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://wikigdrive.com" \ | |
wgd-action-runner:prod /steps/step_render_hugo | |
- name: Copy index for vite | |
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo | |
- uses: docker/build-push-action@v6 | |
with: | |
tags: "wikigdrive-prod:${{ github.sha }},wikigdrive-prod:latest" | |
push: false | |
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}" | |
- name: Stop and remove | |
run: docker stop wikigdrive-prod ; docker rm wikigdrive-prod | |
continue-on-error: true | |
- name: Start | |
run: | | |
docker run -d --name wikigdrive-prod \ | |
--tmpfs /tmp \ | |
-v wikiGDriveProd:/data \ | |
-v /home/wikigdrive/service_account.json:/service_account.json \ | |
-v /home/wikigdrive/env.prod:/usr/src/app/.env \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
-v "/var/www/wikigdrive.com:/usr/src/app/dist/hugo" \ | |
-e "GIT_SHA=${GITHUB_SHA}" \ | |
--publish 127.0.0.1:3000:3000 \ | |
--restart unless-stopped \ | |
"wikigdrive-prod:${GITHUB_SHA}" wikigdrive \ | |
--service_account /service_account.json \ | |
--share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com \ | |
--workdir /data \ | |
server 3000 |