Skip to content

fix: update release-please configuration to include changelog path an… #2

fix: update release-please configuration to include changelog path an…

fix: update release-please configuration to include changelog path an… #2

on:
push:
branches:
- main
permissions:
contents: write
issues: write
pull-requests: write
packages: write
name: release-please
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Optional: Build and attach binaries to the release
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
if: ${{ steps.release.outputs.release_created }}
- name: Build binaries
if: ${{ steps.release.outputs.release_created }}
run: |
# Build for multiple platforms
GOOS=linux GOARCH=amd64 go build -o notion-md-linux-amd64 ./cmd/notion-md
GOOS=linux GOARCH=arm64 go build -o notion-md-linux-arm64 ./cmd/notion-md
GOOS=darwin GOARCH=amd64 go build -o notion-md-darwin-amd64 ./cmd/notion-md
GOOS=darwin GOARCH=arm64 go build -o notion-md-darwin-arm64 ./cmd/notion-md
GOOS=windows GOARCH=amd64 go build -o notion-md-windows-amd64.exe ./cmd/notion-md
- name: Upload Release Artifacts
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.release.outputs.tag_name }} \
notion-md-linux-amd64 \
notion-md-linux-arm64 \
notion-md-darwin-amd64 \
notion-md-darwin-arm64 \
notion-md-windows-amd64.exe
# Build and push Docker image for releases
- name: Set up Docker Buildx
if: ${{ steps.release.outputs.release_created }}
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
if: ${{ steps.release.outputs.release_created }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ steps.release.outputs.tag_name }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.release.outputs.tag_name }}
type=semver,pattern={{major}},value=${{ steps.release.outputs.tag_name }}
type=raw,value=latest
- name: Build and push Docker image
if: ${{ steps.release.outputs.release_created }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max