Merge pull request #26 from d0ugal/release-please--branches--main #55
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: Release Please | |
on: | |
push: | |
branches: [ main ] | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: googleapis/release-please-action@v4 | |
id: release_please | |
with: | |
release-type: go | |
path: . | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Debug info | |
- name: Debug Release Info | |
if: steps.release_please.outputs.release_created == 'true' | |
run: | | |
echo "Release created!" | |
echo "Tag: ${{ steps.release_please.outputs.tag_name }}" | |
echo "Name: ${{ steps.release_please.outputs.name }}" | |
echo "Draft: ${{ steps.release_please.outputs.draft }}" | |
echo "Prerelease: ${{ steps.release_please.outputs.prerelease }}" | |
# Build and push Docker image | |
- name: Set up Docker Buildx | |
if: steps.release_please.outputs.release_created == 'true' | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GHCR | |
if: steps.release_please.outputs.release_created == 'true' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
if: steps.release_please.outputs.release_created == 'true' | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
${{ steps.release_please.outputs.tag_name }} | |
latest | |
- name: Build and push Docker image | |
if: steps.release_please.outputs.release_created == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha,scope=release-${{ steps.release_please.outputs.tag_name }} | |
cache-to: type=gha,mode=max,scope=release-${{ steps.release_please.outputs.tag_name }} | |
continue-on-error: false | |
build-args: | | |
VERSION=${{ steps.release_please.outputs.tag_name }} | |
COMMIT=${{ github.sha }} | |
BUILD_DATE=${{ github.event.head_commit.timestamp }} |