Skip to content

feat: Added automation to create release from tag (#114) #35

feat: Added automation to create release from tag (#114)

feat: Added automation to create release from tag (#114) #35

name: build-and-push-tag-and-main
on:
push:
branches:
- main
tags:
- v*
permissions: read-all
jobs:
build-and-push:
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push image
run: |
docker buildx build \
--platform linux/arm64/v8,linux/amd64,linux/arm,linux/ppc64le,linux/s390x \
--build-arg GO_VERSION=$(grep -m 1 go go.mod | cut -d\ -f2) \
-t ghcr.io/jimmidyson/configmap-reload:${{ github.ref_name == 'main' && 'dev' || github.ref_name }} \
--push \
.
- name: Create release
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ github.token }}
make_latest: true
generate_release_notes: true