Release tag version #89
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 tag version | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
- feature/* | |
inputs: | |
version: | |
required: true | |
description: | |
required: true | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18.3 | |
- name: Setup project | |
run: | | |
go install github.com/vektra/mockery/v2@v2.26.1 | |
make clean gen | |
- name: Tests - Unit | |
run: make test | |
release: | |
runs-on: ubuntu-latest | |
needs: build-test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18.3 | |
- name: Login to Azure Container Registry | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ secrets.ACR_PUBLIC_LOGIN }} | |
username: ${{ secrets.ACR_PUBLIC_USERNAME }} | |
password: ${{ secrets.ACR_PUBLIC_PASSWORD }} | |
- name: Validate version input | |
run: echo ${{ github.event.inputs.version }} | |
- name: Extract base version | |
env: | |
SEM_VERSION: ${{ github.event.inputs.version }} | |
run: | | |
IFS="." | |
read -ra base_version <<< "$SEM_VERSION" | |
echo "BASE_VERSION=$base_version" >> $GITHUB_ENV | |
- name: Create github tag for semantic version | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ github.event.inputs.version }} | |
message: ${{ github.event.inputs.description }} | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.8.1 | |
- name: GoReleaser Release | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: v1.9.0 | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GORELEASER_CURRENT_TAG: ${{ github.event.inputs.version }} | |
- name: Revert local changes and update helm repo for pull request | |
working-directory: ./helm | |
run: | | |
./update_helm_index_locally.sh ${{ github.event.inputs.version }} ${{ env.BASE_VERSION }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
title: Release helm chart ${{ github.event.inputs.version }} | |
base: main | |
add-paths: | | |
helm/* | |
body: | |
branch: version/${{ github.event.inputs.version }} | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Send build / release fail message | |
if: failure() && (startsWith(github.ref, 'refs/tags/') || github.ref=='refs/heads/main') | |
uses: archive/github-actions-slack@v1.0.0 | |
with: | |
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_TOKEN }} | |
slack-channel: '#team-helios-notifications' | |
slack-text: | | |
:thumbsdown: ${{ github.repository }} could not be built / released for version ${{ github.ref }} | |
${{ env.ACTION_URL }} | |
- name: Send build / release success message | |
uses: archive/github-actions-slack@v1.0.0 | |
with: | |
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_TOKEN }} | |
slack-channel: '#team-helios-notifications' | |
slack-text: | | |
:thumbsup: ${{ github.repository }} successfully built / released for version ${{ github.ref }} | |
${{ env.ACTION_URL }} | |