Use decision logs v2 (#44) #121
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: ci | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
push: | |
# Publish `main` as Docker `latest` image. | |
branches: | |
- main | |
- release-* | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- 'v*.*.*' | |
# Run tests for PRs | |
pull_request: | |
branches: | |
- main | |
- release-* | |
env: | |
VAULT_ADDR: https://vault.eng.aserto.com/ | |
PRE_RELEASE: ${{ github.ref == 'refs/heads/main' && 'development' || '' }} | |
GO_VERSION: "1.19" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Setup caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- | |
name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- | |
name: Lint and Test | |
run: | | |
go run mage.go deps generate build lint test | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
# Only release when ref is a tag | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- | |
name: Read Configuration | |
uses: hashicorp/[email protected] | |
id: vault | |
with: | |
url: ${{ env.VAULT_ADDR }} | |
token: ${{ secrets.VAULT_TOKEN }} | |
secrets: | | |
kv/data/github "READ_WRITE_TOKEN" | READ_WRITE_TOKEN; | |
kv/data/github "ASERTO_TAP" | ASERTO_TAP; | |
kv/data/gcp "SERVICE_ACCOUNT_GITHUB_ACTIONS_RELEASE" | SERVICE_ACCOUNT_GITHUB_ACTIONS_RELEASE; | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- | |
name: Setup caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- | |
name: Release | |
env: | |
HOMEBREW_TAP: ${{ steps.vault.outputs.ASERTO_TAP }} | |
GITHUB_TOKEN: ${{ steps.vault.outputs.READ_WRITE_TOKEN }} | |
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gs.json | |
run: | | |
echo "${SERVICE_ACCOUNT_GITHUB_ACTIONS_RELEASE}" > /tmp/gs.json | |
go run mage.go deps generate release |