[scripts] Fix workflow caching wrong folder #14
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: Deploy modpack | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# 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: 0bb89a4872d8dc2c45af251345ee780cab7ab9ad | |
PACKWIZ_DIR: /tmp/packwiz_artifact | |
PACKWIZ: /tmp/packwiz_artifact/packwiz | |
jobs: | |
build_test_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Set up dependencies | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install python dependencies | |
run: pip install -r 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@v6 | |
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 }} | |
- name: Make packwiz executable | |
run: chmod +x ${{ env.PACKWIZ }} | |
# Build | |
- name: Build pack | |
run: python scripts/assemble_packwiz.py | |
# 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 pack | |
run: python scripts/run_test.py | |
# Deploy | |
- name: Configure pages | |
id: pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: generated/pack/ | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |