Merge remote-tracking branch 'origin/develop' into develop #17
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: "Build and Deploy Preview" | |
on: | |
push: | |
branches: | |
- "develop" | |
workflow_dispatch: | |
env: | |
ARTIFACT: "webHelpDHUB2-all.zip" | |
DOCKER_VERSION: "243.21565" | |
INSTANCE: "Writerside/dhub" | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Kotlin | |
uses: fwilhe2/setup-kotlin@main | |
- name: Calculate latest Dungeon Hub API version | |
run: kotlin .github/set-version.main.kts | |
- uses: JetBrains/writerside-github-action@v4 | |
with: | |
instance: ${{ env.INSTANCE }} | |
artifact: ${{ env.ARTIFACT }} | |
docker-version: ${{ env.DOCKER_VERSION }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: | | |
artifacts/${{ env.ARTIFACT }} | |
artifacts/report.json | |
retention-days: 7 | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
path: artifacts | |
- uses: JetBrains/writerside-checker-action@v1 | |
with: | |
instance: ${{ env.INSTANCE }} | |
deploy: | |
# Requires the build job results | |
needs: test | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Kotlin | |
uses: fwilhe2/setup-kotlin@main | |
- name: Switch branch | |
run: | | |
git checkout --orphan preview-deployment | |
- uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
- uses: montudor/action-zip@v1 | |
with: | |
args: unzip -qq ${{ env.ARTIFACT }} -d docs | |
- name: Copy files, commit and push | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
cp -r docs/* . | |
sudo rm -rf docs Writerside .github .idea .editorconfig .gitignore Dockerfile README.md ${{ env.ARTIFACT }} | |
git add . | |
git commit -am "Automatic deployment" | |
git push --force origin preview-deployment | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload entire repository | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |