Skip to content

#15 Upgrading Go

#15 Upgrading Go #46

Workflow file for this run

name: Release
on:
push:
tags:
- "*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.1
- uses: nemerosa/ontrack-github-actions-cli-setup@v1
id: ontrack
with:
only-for: nemerosa
url: https://ontrack.nemerosa.net
token: ${{ secrets.ONTRACK_TOKEN }}
github-token: ${{ github.token }}
- name: Get version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Get Ontrack information
# TODO Use a built-in action, included into the setup
run: |
RESULT=`ontrack-cli build search --project ${{ steps.ontrack.outputs.project }} --display-branch --commit ${{ github.sha }} --count 1`
BRANCH=(${RESULT%/*})
BUILD=(${RESULT#*/})
BUILD_ID=`ontrack-cli build search --project ${{ steps.ontrack.outputs.project }} --display-id --name $BUILD --count 1`
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
echo "BUILD=$BUILD" >> $GITHUB_ENV
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
- name: Displays version and build
run: |
echo VERSION=${VERSION}
echo BRANCH=$BRANCH
echo BUILD=$BUILD
echo BUILD_ID=$BUILD_ID
- name: Build packages
run: ./go-executable-build.bash ${VERSION}
# - name: Change log since last release
# # TODO Use a built-in action
# run: |
# LAST_RELEASE=`ontrack-cli build search --project ${{ steps.ontrack.outputs.project }} --branch $BRANCH --with-promotion RELEASE --count 1 --display-id`
# echo LAST_RELEASE=$LAST_RELEASE
# if [ $LAST_RELEASE != "" ]
# then
# LOG=`ontrack-cli build changelog export --from $LAST_RELEASE --to $BUILD_ID --grouping "Features=feature|Enhancements=enhancement|Bugs=bug"`
# else
# LOG=""
# fi
# echo LOG=$LOG
# echo "LOG=$LOG" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
Version ${{ env.VERSION }}
${{ env.LOG }}
files: ontrack-cli-*
# TODO Release validation
- name: Release marker in Ontrack
run: |
ontrack-cli build set-property --project ${{ steps.ontrack.outputs.project }} --branch $BRANCH --build $BUILD release $VERSION