diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e9bb3af..2fe4813 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,28 +3,32 @@ name: goreleaser on: push: tags: - - v* + - "v*" env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} +permissions: + contents: write + jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: 1.21 - - name: Run GoReleaser and release executables - uses: goreleaser/goreleaser-action@v2 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 with: - version: latest + distribution: goreleaser + version: "~> v2" args: release --clean env: GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }} @@ -40,7 +44,7 @@ jobs: uses: actions/checkout@v2 - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -48,14 +52,14 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v5 with: context: . - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}