Merge pull request #88 from openshift-kni/fix-gh-actions #17
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: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup golang | |
uses: actions/setup-go@v5 | |
id: go | |
with: | |
go-version: 1.23 | |
- name: verify modules | |
run: go mod verify | |
- name: set release version env var | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: build tools | |
run: | | |
make | |
- name: fix build artifacts | |
run: | | |
for tool in knit cpulist; do | |
mv _output/$tool $tool-${{ env.RELEASE_VERSION }}-linux-amd64 | |
done | |
make clean outdir | |
for tool in knit cpulist; do | |
mv $tool-${{ env.RELEASE_VERSION}}-linux-amd64 _output/ | |
done | |
- name: compute signature | |
run: | | |
pushd _output && sha256sum * >> ../SHA256SUMS && mv ../SHA256SUMS . && popd | |
- name: upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: _output/* | |
release: | |
needs: [release-build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# todo: create changelog and/or release body | |
- name: download again the build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: create release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "SHA256SUMS,*-v*-linux-amd64" | |
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |