release #28
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
on: | |
# Run this workflow on the completion of the build-integration workflow | |
workflow_run: | |
workflows: | |
- build-integration | |
types: | |
- completed | |
branches: | |
- master | |
# required to upload artifacts to github releases | |
permissions: | |
contents: write | |
jobs: | |
requires-release: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
outputs: | |
release: ${{ steps.version.outputs.release }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Version | |
id: version | |
run: | | |
CURRENT_VERSION="v$(cat VERSION)" | |
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then | |
echo "Version ${CURRENT_VERSION} is already released" | |
echo "release=false" >> "$GITHUB_OUTPUT" | |
else | |
echo "Version ${CURRENT_VERSION} can be release" | |
echo "release=true" >> "$GITHUB_OUTPUT" | |
fi | |
exit 0 | |
release: | |
needs: requires-release | |
if: ${{ needs.requires-release.outputs.release == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.5 | |
- name: Create tag for new version | |
run: | | |
CURRENT_VERSION="v$(cat VERSION)" | |
git tag $CURRENT_VERSION | |
git push origin $CURRENT_VERSION | |
- uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |