name: release # Publishes ghcr.io//muse. The package inherits this repo's visibility # on first publish, so it lands PRIVATE — pulling it needs a token with # read:packages (see README, "Pulling on a server"). on: push: branches: [main] tags: ["v*"] # Docs-only edits shouldn't burn a build or move :latest. paths-ignore: - "**.md" - ".gitignore" workflow_dispatch: concurrency: # A newer push makes an in-flight build pointless. group: release-${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: ubuntu-latest permissions: contents: read packages: write # required to push to GHCR steps: - uses: actions/checkout@v4 - name: Sanity-check the app before publishing run: | python3 -m pip install --quiet -r requirements.txt python3 -c "import app; print('app imports OK')" - uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} # Automatically provided; no PAT needed for pushing from CI. password: ${{ secrets.GITHUB_TOKEN }} - name: Tags and labels id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=sha,format=short type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - name: Build and push uses: docker/build-push-action@v6 with: context: . # amd64 only: the only host that runs this is x86_64. Adding arm64 # means QEMU emulation and a 3-5x slower build for nothing. platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Summary run: | echo "### Published" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY