Syse 288/deprecating old pipelines #1052
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
# goreleaser knows not to publish when the trigger is _not_ a tag | |
name: Release | |
on: | |
pull_request: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- uses: docker/setup-buildx-action@v2 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- run: make test | |
- name: Login to DockerHub | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- uses: goreleaser/goreleaser-action@v4 | |
with: | |
version: latest | |
args: release --clean ${{ !startsWith(github.ref, 'refs/tags/') && '--snapshot' || '' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ORG_GH_TOKEN }} | |
- name: find amd64 linux binary | |
id: binary | |
run: | | |
path=$(jq '.[] | select((.type=="Binary") and (.goos=="linux") and .goarch=="amd64") | .path' dist/artifacts.json) | |
echo path=${path}" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: binary-amd64 | |
path: ${{ steps.binary.outputs.path }} | |
doctor: | |
needs: goreleaser | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
repo: [tyk, tyk-analytics, tyk-pump, tyk-identity-broker, tyk-sink, portal] | |
branch: [master] | |
feature: [releng] | |
steps: | |
- name: checkout ${{matrix.repo}}/${{matrix.branch}} | |
uses: actions/checkout@v4 | |
with: | |
repository: TykTechnologies/${{ matrix.repo }} | |
ref: ${{ matrix.branch }} | |
token: ${{ secrets.ORG_GH_TOKEN }} | |
path: ${{ matrix.repo }} | |
fetch-depth: 1 | |
- name: checkout gromit | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
path: gromit | |
- uses: actions/download-artifact@v3 | |
id: download | |
with: | |
name: binary-amd64 | |
- name: Check for zero diffs | |
run: | | |
${{ steps.download.outputs.download-path }}/gromit bundle gen --features ./gromit/policy/templates/${{ matrix.feature }} --branch ${{matrix.branch}} --repo ${{ matrix.repo }} ${{ matrix.repo }} | |
echo "## :hospital: ℞ ${{ matrix.repo }} ${{ matrix.feature }} ${{matrix.branch}}" >> $GITHUB_STEP_SUMMARY | |
if gromit policy diff --colours=false ${{ matrix.repo }} 2>summary 1>diff; then | |
echo No treatment required :sunglasses: :thumbsup: >> $GITHUB_STEP_SUMMARY | |
else | |
echo "::error title=${{ matrix.repo }} ${{ matrix.feature }} ${{matrix.branch}}::$(cat summary)" | |
echo '```diff' >> $GITHUB_STEP_SUMMARY | |
cat diff >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi |