Skip to content

Commit

Permalink
Redesign CI
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Dymiński <dyminski@gmail.com>
  • Loading branch information
mateuszdyminski committed Sep 18, 2023
1 parent cb2b477 commit a193f96
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,54 @@ name: build

on:
pull_request:
workflow_call:
secrets:
PERSONAL_ACCESS_TOKEN:
required: true


jobs:
version:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'renovate') == false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect Version for Docker
id: docker-version
run: echo "VERSION=$(SEP="-" scripts/version)" >> $GITHUB_OUTPUT
- name: Detect Version
id: version
run: echo "VERSION=$(scripts/version)" >> $GITHUB_OUTPUT
outputs:
docker-version: ${{ steps.docker-version.outputs.VERSION }}
version: ${{ steps.version.outputs.VERSION }}

build:
runs-on: ubuntu-latest
needs:
- version
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
check-latest: true # https://github.com/actions/setup-go#check-latest-version
cache: true # https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs

- name: Build
run: go build -race ./...

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
install-only: true

- name: Snapshot
if: startsWith(github.ref , 'refs/tags/v') == false
run: make snapshot
env:
GORELEASER_CURRENT_TAG: ${{ needs.version.outputs.docker-version }}

- name: Grype scan
id: scan
uses: anchore/scan-action@v3
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
tags:
- "v*"
pull_request:
workflow_call:
secrets:
PERSONAL_ACCESS_TOKEN:
Expand Down Expand Up @@ -52,22 +51,22 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
check-latest: true # https://github.com/actions/setup-go#check-latest-version
cache: true # https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs

- uses: sigstore/cosign-installer@v3.1.1 # installs cosign
- uses: sigstore/cosign-installer@v3.1.2 # installs cosign
- uses: anchore/sbom-action/download-syft@v0.14.3 # installs syft

- name: Login to GCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: us.gcr.io
username: _json_key
password: ${{ secrets.PUBLIC_GCR_JSON_KEY }}

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
version: latest
install-only: true
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ jobs:
- name: Run FOSSA scan and upload build data
uses: fossa-contrib/fossa-action@v2.0.0
with:
# FOSSA Push-Only API Token
fossa-api-key: 0580abfd8ed19432331e14f6e9eaa7ff
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

scan-codeql:
runs-on: ubuntu-latest
Expand All @@ -39,10 +37,10 @@ jobs:
**/go.sum
**/go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@v2.21.5
uses: github/codeql-action/init@v2.21.7
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v2.21.5
uses: github/codeql-action/autobuild@v2.21.7
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2.21.5
uses: github/codeql-action/analyze@v2.21.7
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'
check-latest: true # https://github.com/actions/setup-go#check-latest-version
cache: true # https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs

Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ signs:
output: true

brews:
- tap:
- repository:
owner: ksoclabs
name: homebrew-kbom
homepage: "https://github.com/ksoclabs/kbom"
Expand Down

0 comments on commit a193f96

Please sign in to comment.