Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 653c200

Browse files
authored
Update GHA release workflow (#152)
* Update GHA release workflow
1 parent a48be9a commit 653c200

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ permissions:
99
contents: write
1010

1111
env:
12+
DOCKER_REPO_NAME: hashicorp/terraform-k8s
1213
KUBEBUILDER_VERSION: 3.3.0
14+
RELEASE_NOTES: /tmp/release-notes.txt
1315

1416
jobs:
1517
go-version:
@@ -31,6 +33,9 @@ jobs:
3133
uses: actions/setup-go@v3
3234
with:
3335
go-version: "${{ needs.go-version.outputs.version }}"
36+
- name: Generate Release Notes
37+
# Fetch CHANGELOG.md contents up to Git tag prior to this release, skipping top two lines
38+
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > ${{ env.RELEASE_NOTES }}
3439
- name: Install kubebuilder
3540
run: |
3641
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${{ env.KUBEBUILDER_VERSION }}/kubebuilder_${{ env.KUBEBUILDER_VERSION }}_linux_amd64.tar.gz -o /tmp/kb.tgz
@@ -39,23 +44,36 @@ jobs:
3944
uses: goreleaser/goreleaser-action@v3.0.0
4045
if: startsWith(github.ref, 'refs/tags/')
4146
with:
42-
args: release --skip-sign
47+
args: release --skip-sign --release-notes ${{ env.RELEASE_NOTES }}
4348
env:
4449
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4550
KUBEBUILDER_ASSETS: /tmp/kubebuilder_${{ env.KUBEBUILDER_VERSION }}_linux_amd64/bin/
51+
4652
release-docker-hub:
4753
runs-on: ubuntu-latest
4854
steps:
49-
- name: Login to DockerHub
55+
- name: Get Docker image tag
56+
env:
57+
TAG: ${{ github.ref_name }}
58+
run: |
59+
echo "DOCKER_IMAGE_TAG=${TAG#v}" >> $GITHUB_ENV
60+
- name: Login to Docker Hub
5061
uses: docker/login-action@v2
5162
with:
5263
username: ${{ secrets.DOCKERHUB_USERNAME }}
5364
password: ${{ secrets.DOCKERHUB_TOKEN }}
54-
- name: Build and push
65+
- name: Set up QEMU
66+
uses: docker/setup-qemu-action@v2
67+
with:
68+
platforms: amd64
69+
- name: Set up Docker Buildx
70+
uses: docker/setup-buildx-action@v2
71+
- name: Build and push Docker image
5572
uses: docker/build-push-action@v3
5673
if: startsWith(github.ref, 'refs/tags/')
5774
with:
58-
push: false
59-
tags: hashicorp/terraform-k8s:${{ github.ref_name }}
75+
push: true
76+
platforms: linux/amd64
77+
tags: ${{ env.DOCKER_REPO_NAME }}:${{ env.DOCKER_IMAGE_TAG }},${{ env.DOCKER_REPO_NAME }}:latest
6078
secrets: |
6179
GIT_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)