Merge branch 'release-0.8.0' #7
Workflow file for this run
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: Release | |
on: | |
# release will only be created when ref is a tag starting with "v" | |
push: | |
tags: | |
- "v*" | |
# run all jobs with these defaults, unless specified otherwise | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release: | |
name: Create Release | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
go-version: ["1.19"] | |
platform: ["ubuntu-latest"] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
fetch-depth: 0 | |
ref: "master" | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: vmware-event-router/go.sum | |
- name: Setup ko | |
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa | |
- name: Create CHANGELOG for Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IMAGE: quay.io/git-chglog/git-chglog | |
# https://quay.io/repository/git-chglog/git-chglog from tag v0.14.2 | |
IMAGE_SHA: 998e89dab8dd8284cfff5f8cfb9e9af41fe3fcd4671f2e86a180e453c20959e3 | |
run: | | |
# update CHANGELOG | |
docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} -o vmware-event-router/RELEASE_CHANGELOG.md $(basename "${{ github.ref }}" ) | |
- name: GoReleaser | |
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 | |
with: | |
args: release --clean --release-notes RELEASE_CHANGELOG.md | |
workdir: vmware-event-router | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GORELEASER_TOKEN: ${{ secrets.GORELEASER_TOKEN }} | |
pull-request: | |
needs: release | |
name: Create CHANGELOG PR | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
continue-on-error: true # errors caused by this job won't stop workflow | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
# for changelog | |
fetch-depth: 0 | |
ref: "master" | |
- name: Create CHANGELOG commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IMAGE: quay.io/git-chglog/git-chglog | |
# https://quay.io/repository/git-chglog/git-chglog from tag v0.14.2 | |
IMAGE_SHA: 998e89dab8dd8284cfff5f8cfb9e9af41fe3fcd4671f2e86a180e453c20959e3 | |
run: | | |
# update CHANGELOG | |
docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} -o CHANGELOG.md | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git config user.name "${{ github.actor }}" | |
git add CHANGELOG.md | |
git commit -m "Update CHANGELOG for $(basename ${{ github.ref }})" | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 | |
with: | |
delete-branch: true | |
title: "Update CHANGELOG" | |
body: | | |
Update CHANGELOG.md for new release | |
- name: Check outputs | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | |
images: | |
needs: release | |
name: Create Github Package image and release.yaml | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
go-version: ["1.19"] | |
platform: ["ubuntu-latest"] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: vmware-event-router/go.sum | |
id: go | |
- name: Setup ko | |
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa | |
- name: Get short COMMIT and TAG | |
run: | | |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV | |
echo "KO_TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV | |
- name: Get Release URL | |
id: get_release_url | |
uses: bruceadams/get-release@74c3d60f5a28f358ccf241a00c9021ea16f0569f # v1.2.3 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Build and push multi-arch image | |
working-directory: ./vmware-event-router | |
run: | | |
# build and push with pre-release tag | |
ko resolve --platform=linux/arm64,linux/amd64 --tags ${KO_COMMIT},${KO_TAG},latest -BRf deploy/event-router-k8s.yaml > release.yaml | |
- name: Upload Release Assets | |
id: upload-release-asset | |
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_url.outputs.upload_url }} | |
asset_path: ./vmware-event-router/release.yaml | |
asset_name: release.yaml | |
asset_content_type: text/plain |