comment #269
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: Deploy modpack | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: ["main", "test"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "deploy" | |
| cancel-in-progress: false | |
| env: | |
| PACKWIZ_COMMIT: a0d66150dfe925708feaa381f761d18a8bf9cf71 | |
| PACKWIZ_DIR: /tmp/packwiz_artifact | |
| PACKWIZ: /tmp/packwiz_artifact/packwiz | |
| jobs: | |
| build_test_deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: "main" | |
| - name: Checkout test | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: "test" | |
| path: test | |
| clean: false | |
| # Set up dependencies | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install main python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Install test python dependencies | |
| run: pip install -r test/requirements.txt | |
| - name: Cache Packwiz | |
| id: cache-packwiz | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.PACKWIZ_DIR }} | |
| key: packwiz-${{ env.PACKWIZ_COMMIT }} | |
| - if: ${{ steps.cache-packwiz.outputs.cache-hit != 'true' }} | |
| name: Download Packwiz | |
| uses: dawidd6/action-download-artifact@v8 | |
| with: | |
| github_token: ${{secrets.GITHUB_TOKEN}} | |
| repo: packwiz/packwiz | |
| workflow: go.yml | |
| name: "Linux 64-bit x86" | |
| path: ${{ env.PACKWIZ_DIR }} | |
| commit: ${{ env.PACKWIZ_COMMIT }} | |
| allow_forks: true | |
| - name: Make packwiz executable | |
| run: chmod +x ${{ env.PACKWIZ }} | |
| # Build | |
| - name: Build main pack | |
| run: python scripts/assemble_packwiz.py | |
| - name: Build test pack | |
| run: python test/scripts/assemble_packwiz.py | |
| env: | |
| BRANCH_OVERRIDE: test | |
| # Setup test-runner cache | |
| - name: Generate cache key | |
| run: python scripts/run_test.py | |
| env: | |
| GENERATE_DESIRED_CACHE_STATE_AND_EXIT: true | |
| - name: Cache test-runner (static cache) | |
| uses: actions/cache@v4 | |
| with: | |
| path: run/cache-static/ | |
| key: test-run-static-cache-${{ hashFiles('run/desired_cache_state_for_static_cache.json') }} # Try and get the desired state | |
| restore-keys: test-run-static-cache- # But fall back if needed | |
| - name: Cache test-runner (dynamic cache) | |
| uses: actions/cache@v4 | |
| with: | |
| path: run/cache-dynamic/ | |
| key: test-run-dynamic-cache-${{ hashFiles('generated/pack/pack.toml') }} # pack.toml contains hashes for all other files | |
| restore-keys: test-run-dynamic-cache- | |
| # Run tests | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' # See 'Supported distributions' for available options | |
| java-version: '21' | |
| - name: Test main pack | |
| run: python scripts/run_test.py | |
| - name: Test test pack | |
| run: python test/scripts/run_test.py | |
| env: | |
| BRANCH_OVERRIDE: test | |
| # Deploy | |
| - name: Copy test pack | |
| run: cp -r test/generated/pack generated/pack/test | |
| - name: Configure pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: generated/pack/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |