Merge pull request #2966 from UmedMuzl/portal-fix #2132
This file contains hidden or 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: Release to Github Pages | |
| on: | |
| push: | |
| branches: [ dev ] | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| if: contains(github.actor, '[bot]') | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Check if archipelago.json version is newer than latest release | |
| id: check_version | |
| run: | | |
| # Get the version from archipelago.json in the current branch | |
| AP_VERSION=$(jq -r '.world_version' archipelago.json) | |
| echo "Current archipelago.json version: $AP_VERSION" | |
| # Get the latest release tag from DK64-Randomizer-Dev | |
| LATEST_TAG=$(curl -s https://api.github.com/repos/2dos/DK64-Randomizer-Dev/releases/latest | jq -r .tag_name) | |
| echo "Latest release tag: $LATEST_TAG" | |
| # Remove leading 'v' if present | |
| LATEST_VERSION=${LATEST_TAG#v} | |
| # Compare versions | |
| VERSION_CHANGED=false | |
| if [ "$AP_VERSION" != "$LATEST_VERSION" ]; then | |
| VERSION_CHANGED=true | |
| fi | |
| echo "version_changed=$VERSION_CHANGED" >> $GITHUB_OUTPUT | |
| if [ "$VERSION_CHANGED" = "true" ]; then | |
| echo "archipelago.json version ($AP_VERSION) is different from latest release ($LATEST_VERSION)" | |
| else | |
| echo "archipelago.json version ($AP_VERSION) matches latest release ($LATEST_VERSION)" | |
| fi | |
| - name: Setup python | |
| uses: actions/[email protected] | |
| with: | |
| python-version: 3.13.0 | |
| architecture: x64 | |
| - name: Install packages | |
| run: | | |
| pip install -r requirements-dev.txt | |
| pip install wheel setuptools | |
| - name: NPM install | |
| run: | | |
| npm install | |
| node_modules/nunjucks/bin/precompile templates/ > ./static/js/compile_templates.js | |
| rm -rf ./node_modules | |
| - name: Build APworld file | |
| run: python3 ./tools/package_apworld.py | |
| - name: Build minified versions | |
| run: python3 ./tools/prepare_live.py | |
| - name: Remove Git Ignore (This might be changed in the future) | |
| run: rm .gitignore | |
| - name: Move Files | |
| run: mkdir ./deploy-directory && mv -f ./* ./deploy-directory/ || true | |
| - name: Pre Write Files | |
| run: echo 'This repo Dev Github Pages for DK64Rando, you need to go to https://github.com/2dos/DK64-Randomizer' > ./deploy-directory/README.md && echo 'dev.dk64randomizer.com' > ./deploy-directory/CNAME && touch ./deploy-directory/.nojekyll | |
| - name: Deploy to Github Pages | |
| uses: hpcodecraft/[email protected] | |
| env: | |
| GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
| SRC_FOLDER: ./deploy-directory | |
| DEST_OWNER: 2dos | |
| DEST_REPO: DK64-Randomizer-Dev | |
| DEST_BRANCH: main | |
| DEST_FOLDER: ./ | |
| DEST_PREDEPLOY_CLEANUP: rm -rf ./* | |
| - name: Get version from archipelago.json | |
| if: steps.check_version.outputs.version_changed == 'true' | |
| id: get_version | |
| run: | | |
| VERSION=$(jq -r '.world_version' ./deploy-directory/archipelago.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Create Release in Target Repo | |
| if: steps.check_version.outputs.version_changed == 'true' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.ACCESS_TOKEN }} | |
| owner: 2dos | |
| repo: DK64-Randomizer-Dev | |
| tag: v${{ steps.get_version.outputs.version }} | |
| name: DK64 Randomizer APWorld v${{ steps.get_version.outputs.version }} | |
| body: | | |
| DK64 Randomizer APWorld file for Archipelago version ${{ steps.get_version.outputs.version }} | |
| This release contains the dk64.apworld file that can be used with the Archipelago multiworld randomizer. | |
| artifacts: ./deploy-directory/dk64.apworld | |
| makeLatest: true | |