Skip to content

Release

Release #36

Workflow file for this run

name: Release
on:
workflow_run:
workflows:
- CI
types:
- completed
branches:
- main
permissions:
contents: write
jobs:
Release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_commit.message, 'Prepare release v') }}
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 0
- name: Fetch Version
run: |
PLUGIN_VERSION=v$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)
LATEST_VERSION=$(git describe --tags --abbrev=0)
echo PLUGIN_VERSION=$PLUGIN_VERSION >> "$GITHUB_ENV"
echo LATEST_VERSION=$LATEST_VERSION >> "$GITHUB_ENV"
- name: Check Version
if: ${{ env.PLUGIN_VERSION == env.LATEST_VERSION }}
run: echo "Plugin version already released. Please make sure you have prepared the release first." && exit 1
- name: Set Golang
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.21.9
- name: Build
run: make build
- name: Create tag
run: git tag $PLUGIN_VERSION
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}