Skip to content

Commit

Permalink
Merge pull request #48 from score-spec/split-ci-release
Browse files Browse the repository at this point in the history
Split CI versus release
  • Loading branch information
mathieu-benoit authored Oct 14, 2024
2 parents f26f70b + 3feb136 commit 2d54712
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 54 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ci
on:
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run Go Tests
run: go test ./... -cover -race
- name: Build binary
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: build --snapshot
- name: Install license check tool
run: go install github.com/google/addlicense@latest
- name: Check licenses
run: addlicense -l apache -check -v -ignore '**/*.yaml' -c Humanitec ./*.go ./internal/
61 changes: 7 additions & 54 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,71 +1,24 @@
name: release

on:
pull_request:
push:
branches:
- 'main'

permissions:
contents: read

tags:
- 0.**
permissions: write-all
jobs:

test:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Fetch all tags
run: git fetch --force --tags
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
-
name: Run Go Tests
run: go test ./... -cover -race
-
name: Build binary
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: build --snapshot
-
name: Install license check tool
run: go install github.com/google/addlicense@latest
-
name: Check licenses
run: addlicense -l apache -check -v -ignore '**/*.yaml' -c Humanitec ./*.go ./internal/

release:
if: startsWith(github.ref, 'refs/tags/0.')
needs:
- test
runs-on: ubuntu-latest
permissions: write-all
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Fetch all tags
- name: Fetch all tags
run: git fetch --force --tags
-
name: Set up Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
Expand Down

0 comments on commit 2d54712

Please sign in to comment.