Repository navigation
Move the craft, cancel and stock-rule checks out of the routes (#198) #53
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: Testing | |
| # Each push to main: the whole of ci.yml, then the server image tagged | |
| # sha-<commit> (and main), deployed to the testing instance beside | |
| # production (deploy/gcm-deploy.sh). Releases still deploy production | |
| # from publish.yml. | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # One run at a time, never cancelled: a push while one runs waits, and a | |
| # later push replaces it while it waits, so testing ends on the newest | |
| # commit without a deploy being cut off halfway. | |
| concurrency: | |
| group: testing | |
| cancel-in-progress: false | |
| jobs: | |
| ci: | |
| name: CI | |
| uses: $/.github/workflows/ci.yml | |
| image: | |
| name: Image | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| tag: ${{ steps.scripts.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| # The tags and history, for the scripts version below. | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| # Usually the last release's; empty after a scripts change that's | |
| # not released yet, which shows no update notice. | |
| - id: scripts | |
| run: | | |
| version=$(.github/scripts/scripts-version.sh "$GITHUB_SHA") | |
| echo "Scripts version: ${version:-none}" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "tag=sha-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| # Not a vX.Y.Z, so the Status dialog shows it but auto-update | |
| # stays off (gcm/agents.py _auto_update_target()). | |
| echo "server_version=main-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: meta | |
| uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=${{ steps.scripts.outputs.tag }} | |
| type=raw,value=main | |
| - uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 | |
| with: | |
| context: server | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| GCM_VERSION=${{ steps.scripts.outputs.server_version }} | |
| GCM_SCRIPTS_VERSION=${{ steps.scripts.outputs.version }} | |
| # The release cache (publish.yml), written here too, so the next | |
| # release starts from main's layers. | |
| cache-from: type=registry,ref=ghcr.io/maselkov/gtnh-craft-monitor:buildcache | |
| cache-to: type=registry,ref=ghcr.io/maselkov/gtnh-craft-monitor:buildcache,mode=max | |
| deploy: | |
| name: Deploy | |
| needs: image | |
| permissions: | |
| contents: read | |
| packages: read | |
| # Without secrets: inherit the called job reads its environment's | |
| # secrets as empty. It only reaches this repo's own deploy.yml, from | |
| # the same commit. | |
| uses: $/.github/workflows/deploy.yml # zizmor: ignore[secrets-inherit] | |
| secrets: inherit | |
| with: | |
| environment: testing | |
| tag: ${{ needs.image.outputs.tag }} |