feat/vitepress #718
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: Pull request created | |
on: | |
pull_request: | |
types: [edited, synchronize] | |
paths-ignore: | |
- 'develop/**' | |
jobs: | |
test: | |
if: github.event.pull_request.head.ref != 'develop' && contains( github.event.pull_request.labels.*.name, 'deploy-pr') | |
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: | |
if: github.event.pull_request.head.ref != 'develop' && contains( github.event.pull_request.labels.*.name, 'deploy-pr') | |
needs: test | |
runs-on: wgd-dev | |
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:pr-${{ github.event.number }}" --build-arg "GIT_SHA=${{ github.sha }}" apps/wgd-action-runner | |
- name: build | |
uses: docker/build-push-action@v6 | |
with: | |
tags: "wikigdrive-feature:${{ github.sha }}" | |
push: false | |
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}" | |
- name: Build docs | |
run: | | |
docker run \ | |
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/usr/src/app/website/.vuepress/dist" \ | |
"wikigdrive-feature:${{ github.sha }}" npm run docs:build | |
- name: Stop and remove | |
run: docker stop "pr-${{ github.event.number }}" ; docker rm "pr-${{ github.event.number }}" | |
continue-on-error: true | |
- name: "Create empty volume" | |
run: docker volume create "pr-${{ github.event.number }}" | |
continue-on-error: true | |
- name: Start | |
run: | | |
docker run -d --name "pr-${{ github.event.number }}" \ | |
--restart unless-stopped \ | |
--network nginx \ | |
--tmpfs /tmp \ | |
-v "pr-${{ github.event.number }}":/data \ | |
-v /home/wikigdrive/service_account.json:/service_account.json \ | |
-v /home/wikigdrive/env.pr:/usr/src/app/.env \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
-v /var/run/podman/podman.sock:/var/run/podman/podman.sock \ | |
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/usr/src/app/website/.vuepress/dist" \ | |
-e "GIT_SHA=${{ github.sha }}" \ | |
-e "ZIPKIN_URL=https://pr-${{ github.event.number }}.wikigdrive.com/zipkin" \ | |
-e "ZIPKIN_SERVICE=pr-${{ github.event.number }}" \ | |
-e "AUTH_DOMAIN=https://dev.wikigdrive.com" \ | |
-e "AUTH_INSTANCE=pr-${{ github.event.number }}" \ | |
-e "DOMAIN=https://pr-${{ github.event.number }}.wikigdrive.com" \ | |
-e "ACTION_IMAGE=wgd-action-runner:pr-${{ github.event.number }}" \ | |
"wikigdrive-feature:${{ github.sha }}" wikigdrive \ | |
--service_account /service_account.json \ | |
--share_email [email protected] \ | |
--workdir /data \ | |
server 3000 | |
remove: | |
if: github.event.pull_request.head.ref != 'develop' && !contains( github.event.pull_request.labels.*.name, 'deploy-pr') | |
runs-on: wgd-dev | |
steps: | |
- name: Stop and remove | |
run: docker stop "pr-${{ github.event.number }}" ; docker rm "pr-${{ github.event.number }}" | |
continue-on-error: true |