Skip to content

Commit

Permalink
feat(workflows): build and publish docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
golobitch committed Apr 29, 2024
1 parent 6a39bcf commit faa414b
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/docker-build-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build & Publish

on:
pull_request:
branches:
- '**'
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 5
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build and push
uses: docker/build-push-action@v5
with:
push: true
build-args: GO_VERSION=1.22
tags: ghcr.io/${{ github.repository_owner }}/gandi-cert-manager-webhook:${{ github.ref_name }},ghcr.io/${{ github.repository_owner }}/gandi-cert-manager-webhook:latest

generate-release:
runs-on: ubuntu-latest
needs: publish
timeout-minutes: 5
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
tag: ${{ github.ref_name }}
token: ${{ github.token }}
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md

0 comments on commit faa414b

Please sign in to comment.