Merge pull request #65 from anchore/async-fixes #9
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: | |
# take no actions on push to any branch... | |
branches-ignore: | |
- "**" | |
# ... only act on tags | |
tags: | |
- v1.* | |
- v2.* | |
env: | |
GO_VERSION: "1.21.x" | |
jobs: | |
quality-gate: | |
environment: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# we don't want to release commits that have been pushed and tagged, but not necessarily merged onto main | |
- name: Ensure tagged commit is on main | |
run: | | |
echo "Tag: ${GITHUB_REF##*/}" | |
git fetch origin main | |
git merge-base --is-ancestor ${GITHUB_REF##*/} origin/main && echo "${GITHUB_REF##*/} is a commit on main!" | |
- name: Check unit test results | |
uses: fountainhead/[email protected] | |
id: unit | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Unit tests" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Check container build test results | |
uses: fountainhead/[email protected] | |
id: container | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | |
checkName: "Container Build Test" | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Quality gate | |
if: steps.unit.outputs.conclusion != 'success' || steps.container.outputs.conclusion != 'success' | |
run: | | |
echo "Unit Test Status: ${{ steps.unit.outputs.conclusion }}" | |
echo "Integration Test Status: ${{ steps.container.outputs.conclusion }}" | |
false | |
release: | |
needs: [quality-gate] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Restore tool cache | |
id: tool-cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ github.workspace }}/.tmp | |
key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }} | |
- name: Restore go cache | |
id: go-cache | |
uses: actions/[email protected] | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ env.GO_VERSION }}- | |
- name: Install tools | |
run: make bootstrap-tools | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.TOOLBOX_DOCKER_USER }} | |
password: ${{ secrets.TOOLBOX_DOCKER_PASS }} | |
- name: Build & publish release artifacts | |
run: make release | |
env: | |
GITHUB_TOKEN: ${{ secrets.CI_WRITE_GITHUB_TOKEN }} |