From 342fd869a2f3d20db27025edd9c4d38b7b8eb821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Walther?= Date: Mon, 17 Apr 2023 11:50:05 +0200 Subject: [PATCH] Add workflow for dev-portal deployment --- .github/workflows/cd-dev.yml | 76 ++++++++++++++++++++++++++++++ documentation/dev-portal/README.md | 1 + 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/cd-dev.yml diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml new file mode 100644 index 0000000000..c2628a5ac1 --- /dev/null +++ b/.github/workflows/cd-dev.yml @@ -0,0 +1,76 @@ +name: Continous deployment + +on: + push: + branches: feature/add-workflows-devportal + paths: + - 'documentation/docs/**' + +jobs: + build: + runs-on: custom-runner-linux + steps: + - uses: actions/checkout@v3 + - name: Install rsync + run: sudo apt-get install rsync + - uses: rlespinasse/github-slug-action@v3.x + - uses: actions/setup-node@v3 + with: + node-version: "16" + - name: Install Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install mdbook + run: (test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.4" mdbook) + - name: Install mdbook plugins + run: | + cargo install --vers "^0.2.0" mdbook-variables && cargo install \ + --vers "^1.8.0" mdbook-admonish && cargo install --vers \ + "^0.1.2" mdbook-last-changed && cargo install --vers "^0.1.2" \ + mdbook-theme && cargo install --vers "^0.7.7" mdbook-linkcheck + - name: Clean website + run: cd documentation/dev-portal && mdbook clean + - name: Build website + run: cd documentation/dev-portal && mdbook build + - name: Deploy branch master to dev + continue-on-error: true + uses: easingthemes/ssh-deploy@main + env: + SSH_PRIVATE_KEY: ${{ secrets.CD_WWW_SSH_PRIVATE_KEY }} + ARGS: "-rltgoDzvO --delete" + SOURCE: "documentation/dev-portal/book/html/" + REMOTE_HOST: ${{ secrets.CD_WWW_REMOTE_HOST_DEV }} + REMOTE_USER: ${{ secrets.CD_WWW_REMOTE_USER }} + TARGET: ${{ secrets.CD_WWW_REMOTE_TARGET_DEVP }}/ + EXCLUDE: "/dist/, /node_modules/" + - name: Deploy branch master to prod + uses: easingthemes/ssh-deploy@main + env: + SSH_PRIVATE_KEY: ${{ secrets.CD_WWW_SSH_PRIVATE_KEY }} + ARGS: "-rltgoDzvO --delete" + SOURCE: "documentation/dev-portal/book/html/" + REMOTE_HOST: ${{ secrets.CD_WWW_REMOTE_HOST_PROD }} + REMOTE_USER: ${{ secrets.CD_WWW_REMOTE_USER }} + TARGET: ${{ secrets.CD_WWW_REMOTE_TARGET_DEVP }}/ + EXCLUDE: "/dist/, /node_modules/" + - name: Matrix - Node Install + run: npm install + working-directory: .github/workflows/support-files + - name: Matrix - Send Notification + env: + NYM_NOTIFICATION_KIND: cd-dev + NYM_PROJECT_NAME: "Dev portal CD" + NYM_CI_WWW_BASE: "${{ secrets.NYM_CD_WWW_BASE }}" + NYM_CI_WWW_LOCATION: "${{ env.GITHUB_REF_SLUG }}" + GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}" + GIT_BRANCH: "${GITHUB_REF##*/}" + MATRIX_SERVER: "${{ secrets.MATRIX_SERVER }}" + MATRIX_ROOM: "${{ secrets.MATRIX_ROOM }}" + MATRIX_USER_ID: "${{ secrets.MATRIX_USER_ID }}" + MATRIX_TOKEN: "${{ secrets.MATRIX_TOKEN }}" + MATRIX_DEVICE_ID: "${{ secrets.MATRIX_DEVICE_ID }}" + IS_SUCCESS: "${{ job.status == 'success' }}" + uses: docker://keybaseio/client:stable-node + with: + args: .github/workflows/support-files/notifications/entry_point.sh diff --git a/documentation/dev-portal/README.md b/documentation/dev-portal/README.md index b43fbc7d2c..72c0e12d46 100644 --- a/documentation/dev-portal/README.md +++ b/documentation/dev-portal/README.md @@ -22,3 +22,4 @@ You can find other commands in the [mdBook CLI tool docs](https://rust-lang.gith ### I tried to edit files in `theme/` and they aren't taking effect / `mdbook serve` causes a looping reload on file changes after changing fields in `[preprocessor.theme]` config Looping reload is a known issue with the `mdbook-theme` preprocessor used for the table of contents and layout of these docs. As outlined in the `mdbook-theme` [readme](https://github.com/zjp-CN/mdbook-theme#avoid-repeating-call-on-this-tool-when-mdbook-watch) one way to mitigate this is to set `turn-off = true` under `[preprocessor.theme]`. This means that `mdbook serve` or `mdbook watch` ignores changes to the `theme/` directory, which is the source of the looping reload. If you have changed or commented out this line, reintroduce it to remove the looping reload. If you are trying to edit the theme of the docs and want to apply the change, see [here](https://github.com/zjp-CN/mdbook-theme#avoid-repeating-call-on-this-tool-when-mdbook-watch) for more info on how to remove the block, change the theme, and reintroduce the block. +