diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 286d517..b9d0d0d 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -12,8 +12,51 @@ permissions: jobs: release-please: runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + version: ${{ steps.release.outputs.version }} steps: - uses: googleapis/release-please-action@v4 + id: release with: config-file: release-please-config.json manifest-file: .release-please-manifest.json + + # Releases made by release-please don't trigger other workflows (GitHub ignores events + # created with GITHUB_TOKEN), so the image is published from here instead. + publish-image: + needs: release-please + if: needs.release-please.outputs.release_created == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v5 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/uio-gaming/mustafa + tags: | + type=semver,pattern={{version}},value=${{ needs.release-please.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.version }} + type=semver,pattern={{major}},value=${{ needs.release-please.outputs.version }} + type=raw,value=latest + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max