fix: change version in golang-example.yaml #3
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: Create and publish a Docker image | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.2.1 | |
- name: Get Next Semver Version | |
id: semver | |
uses: ietf-tools/semver-action@v1.8.0 | |
with: | |
token: ${{ github.token }} | |
branch: main | |
noVersionBumpBehavior: warn | |
- name: Create Tag | |
uses: rickstaa/action-create-tag@v1.7.2 | |
if: ${{ steps.semver.outputs.nextStrict != '' }} | |
with: | |
tag: ${{ steps.semver.outputs.nextStrict }} | |
tag_exists_error: false | |
message: "Automatic tag ${{ steps.semver.outputs.nextStrict }}" | |
- name: Update CHANGELOG | |
id: changelog | |
uses: requarks/changelog-action@v1.10.2 | |
if: ${{ steps.semver.outputs.nextStrict != '' }} | |
with: | |
token: ${{ github.token }} | |
fromTag: ${{ steps.semver.outputs.nextStrict }} | |
toTag: ${{ steps.semver.outputs.current }} | |
excludeTypes: "chore,ci,docs,style,test,release" | |
- name: Create Release | |
uses: ncipollo/release-action@v1.14.0 | |
id: release | |
if: ${{ steps.semver.outputs.nextStrict != '' }} | |
with: | |
allowUpdates: true | |
draft: false | |
makeLatest: true | |
name: ${{ steps.semver.outputs.nextStrict }} | |
tag: ${{ steps.semver.outputs.nextStrict }} | |
body: ${{ steps.changelog.outputs.changes }} | |
token: ${{ github.token }} | |
- name: Commit CHANGELOG.md | |
uses: stefanzweifel/git-auto-commit-action@v5.0.1 | |
if: ${{ steps.semver.outputs.nextStrict != '' }} | |
with: | |
branch: main | |
commit_message: "release: changelog for ${{ steps.semver.outputs.nextStrict }} [skip ci]" | |
file_pattern: CHANGELOG.md | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v3.7.1 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3.3.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6.9.0 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.semver.outputs.nextStrict }} | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} |