-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cyber OS Lab. <99838653+cyberoslab@users.noreply.github.com>
- Loading branch information
Cyber OS Lab
authored
Jun 27, 2023
1 parent
5b9f904
commit 0274619
Showing
1 changed file
with
141 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
name: "Release" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: tag the latest commit on main with the given version (prefixed with v) | ||
required: true | ||
|
||
env: | ||
GO_VERSION: "1.19.x" | ||
|
||
jobs: | ||
quality-gate: | ||
environment: release | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Check if tag already exists | ||
# note: this will fail if the tag already exists | ||
run: | | ||
[[ "${{ github.event.inputs.version }}" == v* ]] || (echo "version '${{ github.event.inputs.version }}' does not have a 'v' prefix" && exit 1) | ||
git tag ${{ github.event.inputs.version }} | ||
- name: Check static analysis results | ||
uses: fountainhead/action-wait-for-check@v1.1.0 | ||
id: static-analysis | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | ||
checkName: "Static analysis" | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
- name: Check unit test results | ||
uses: fountainhead/action-wait-for-check@v1.1.0 | ||
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 integration test results | ||
uses: fountainhead/action-wait-for-check@v1.1.0 | ||
id: integration | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | ||
checkName: "Integration tests" | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
- name: Check acceptance test results (linux) | ||
uses: fountainhead/action-wait-for-check@v1.1.0 | ||
id: acceptance-linux | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | ||
checkName: "Acceptance tests (Linux)" | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
- name: Check acceptance test results (mac) | ||
uses: fountainhead/action-wait-for-check@v1.1.0 | ||
id: acceptance-mac | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | ||
checkName: "Acceptance tests (Mac)" | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
- name: Check cli test results (linux) | ||
uses: fountainhead/action-wait-for-check@v1.1.0 | ||
id: cli-linux | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# This check name is defined as the github action job name (in .github/workflows/testing.yaml) | ||
checkName: "CLI tests (Linux)" | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
|
||
- name: Quality gate | ||
if: steps.static-analysis.outputs.conclusion != 'success' || steps.unit.outputs.conclusion != 'success' || steps.integration.outputs.conclusion != 'success' || steps.cli-linux.outputs.conclusion != 'success' || steps.acceptance-linux.outputs.conclusion != 'success' || steps.acceptance-mac.outputs.conclusion != 'success' | ||
run: | | ||
echo "Static Analysis Status: ${{ steps.static-analysis.conclusion }}" | ||
echo "Unit Test Status: ${{ steps.unit.outputs.conclusion }}" | ||
echo "Integration Test Status: ${{ steps.integration.outputs.conclusion }}" | ||
echo "Acceptance Test (Linux) Status: ${{ steps.acceptance-linux.outputs.conclusion }}" | ||
echo "Acceptance Test (Mac) Status: ${{ steps.acceptance-mac.outputs.conclusion }}" | ||
echo "CLI Test (Linux) Status: ${{ steps.cli-linux.outputs.conclusion }}" | ||
false | ||
release: | ||
needs: [quality-gate] | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Bootstrap environment | ||
uses: ./.github/actions/bootstrap | ||
with: | ||
# use the same cache we used for building snapshots | ||
build-cache-key-prefix: "snapshot" | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.TOOLBOX_DOCKER_USER }} | ||
password: ${{ secrets.TOOLBOX_DOCKER_PASS }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Tag release | ||
run: | | ||
git tag ${{ github.event.inputs.version }} | ||
git push origin --tags | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build & publish release artifacts | ||
run: make ci-release | ||
env: | ||
# for mac signing and notarization... | ||
# for creating the release (requires write access to packages and content) | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# for updating the VERSION file in S3... | ||
|
||
- uses: anchore/sbom-action@v0 | ||
continue-on-error: true | ||
with: | ||
artifact-name: sbom.spdx.json | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: dist/**/* |