fix: possible fix of 403 forbidden #7
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: Release please | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release-please: | |
name: Release | |
runs-on: ubuntu-latest | |
outputs: | |
release: ${{ steps.release.outputs.release_created }} | |
tag: ${{ steps.release.outputs.tag_name }} | |
sha: ${{ steps.release.outputs.sha }} | |
steps: | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
with: | |
config-file: release-please-config.json | |
manifest-file: .release-please-manifest.json | |
push_to_registry: | |
needs: [ release-please ] | |
name: Push Docker image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
if: ${{ needs.release-please.outputs.release }} | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
REGISTRY: ghcr.io | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
install: true | |
use: true | |
- name: Builder instance name | |
run: echo ${{ steps.buildx.outputs.name }} | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Log in to Docker | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
logout: false | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
id: push | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
build-args: | | |
- VER="3.19" | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release-please.outputs.tag }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true | |
- name: clean | |
if: always() && github.event_name != 'pull_request' | |
run: | | |
rm -f ${HOME}/.docker/config.json |