Update GitHub Actions runner images to ubuntu-22.04 #119
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: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: ['main', 'release/**'] | |
paths: | |
- '.github/workflows/releases.yml' | |
- 'scripts/**' | |
- 'Makefile' | |
env: | |
GO_VERSION: '1.22.6' | |
permissions: | |
contents: write | |
deployments: write | |
jobs: | |
setup-environment: | |
runs-on: ubuntu-22.04 | |
env: | |
RELEASE_TAG: '' | |
DYNAMIC_BINARY_NAME: '' | |
STATIC_BINARY_NAME: '' | |
steps: | |
- name: Export cleaned release tag | |
run: | | |
export release_tag=${GITHUB_REF#refs/*/} # Strip down to raw tag name | |
echo "RELEASE_TAG=${release_tag}" >> $GITHUB_ENV | |
- name: Create dummy environment for release | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "RELEASE_TAG=v0.0.0" >> $GITHUB_ENV | |
- name: Setup variables and release directories | |
run: | | |
export release_tag=${{ env.RELEASE_TAG }} | |
export release_version=${release_tag/v/} # Remove v from tag name | |
echo "DYNAMIC_BINARY_NAME=soci-snapshotter-${release_version}-linux-amd64.tar.gz" >> $GITHUB_ENV | |
echo "STATIC_BINARY_NAME=soci-snapshotter-${release_version}-linux-amd64-static.tar.gz" >> $GITHUB_ENV | |
outputs: | |
release_tag: ${{ env.RELEASE_TAG }} | |
dynamic_binary_name: ${{ env.DYNAMIC_BINARY_NAME }} | |
static_binary_name: ${{ env.STATIC_BINARY_NAME }} | |
generate-artifacts: | |
needs: setup-environment | |
runs-on: ubuntu-22.04 | |
container: | |
image: public.ecr.aws/ubuntu/ubuntu:20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: install build dependencies | |
run: bash scripts/install-build-dependencies.sh | |
- name: Create dummy THIRD_PARTY_LICENSES file for pull request | |
if: github.event_name == 'pull_request' | |
run: | | |
touch THIRD_PARTY_LICENSES | |
- name: Create release binaries | |
shell: bash | |
run: make RELEASE_TAG=${{ needs.setup-environment.outputs.RELEASE_TAG }} release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: release/ | |
if-no-files-found: error | |
validate-artifacts: | |
needs: [setup-environment, generate-artifacts] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: release/ | |
- run: bash scripts/verify-release-artifacts.sh ${{ needs.setup-environment.outputs.release_tag }} | |
create-release: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [setup-environment, validate-artifacts] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
- uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
prerelease: false | |
generate_release_notes: false | |
files: | | |
${{ needs.setup-environment.outputs.dynamic_binary_name }} | |
${{ needs.setup-environment.outputs.dynamic_binary_name }}.sha256sum | |
${{ needs.setup-environment.outputs.static_binary_name }} | |
${{ needs.setup-environment.outputs.static_binary_name }}.sha256sum |