-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: setup semantic release Signed-off-by: David van der Spek <[email protected]> * ci: remove setup node Signed-off-by: David van der Spek <[email protected]> --------- Signed-off-by: David van der Spek <[email protected]>
- Loading branch information
Showing
3 changed files
with
88 additions
and
40 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 |
---|---|---|
|
@@ -10,26 +10,39 @@ env: | |
GOPATH: /home/runner/go/ | ||
GOPROXY: "https://proxy.golang.org" | ||
jobs: | ||
build: | ||
name: Build | ||
prepare: | ||
name: Prepare release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
outputs: | ||
new_release_version: ${{ steps.semantic_release.outputs.new_release_version }} | ||
new_release_published: ${{ steps.semantic_release.outputs.new_release_published }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
- run: PATH=$PATH:$GOPATH/bin make build | ||
image: | ||
name: Build image | ||
fetch-depth: 0 | ||
token: ${{ secrets.PLURAL_BOT_PAT }} | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v3 | ||
id: semantic_release | ||
with: | ||
dry_run: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PLURAL_BOT_PAT }} | ||
NODE_AUTH_TOKEN: ${{ secrets.PLURAL_BOT_NPM_TOKEN }} | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
- run: PATH=$PATH:$GOPATH/bin make docker-build | ||
- run: PATH=$PATH:$GOPATH/bin make build | ||
test: | ||
name: Unit test | ||
runs-on: ubuntu-latest | ||
|
@@ -55,7 +68,9 @@ jobs: | |
publish: | ||
name: Build and push Agent container | ||
runs-on: ubuntu-20.04 | ||
needs: test | ||
needs: | ||
- prepare | ||
- test | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
|
@@ -77,30 +92,11 @@ jobs: | |
type=sha | ||
type=ref,event=pr | ||
type=ref,event=branch | ||
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.new_release_version }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
# - uses: google-github-actions/auth@v1 | ||
# with: | ||
# workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github' | ||
# service_account: '[email protected]' | ||
# token_format: 'access_token' | ||
# create_credentials_file: true | ||
# - uses: google-github-actions/[email protected] | ||
# - name: Login to gcr | ||
# run: gcloud auth configure-docker -q | ||
# - name: installing plural | ||
# id: plrl | ||
# uses: pluralsh/[email protected] | ||
# with: | ||
# email: [email protected] | ||
# - name: Login to plural registry | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# registry: dkr.plural.sh | ||
# username: [email protected] | ||
# password: ${{ steps.plrl.outputs.token }} | ||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
|
@@ -115,16 +111,36 @@ jobs: | |
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64 | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
GIT_COMMIT=${{ github.sha }} | ||
- name: slack webhook | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: workflow,job,repo,message,commit,author | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required | ||
if: always() | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
if: github.event_name != 'pull_request' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.PLURAL_BOT_PAT }} | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v3 | ||
id: semantic_release | ||
if: github.event_name != 'pull_request' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PLURAL_BOT_PAT }} | ||
NODE_AUTH_TOKEN: ${{ secrets.PLURAL_BOT_NPM_TOKEN }} | ||
- name: slack webhook | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: workflow,job,repo,message,commit,author | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required | ||
if: always() |
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,18 @@ | ||
name: "Semantic PR" | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,14 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "conventionalcommits" | ||
} | ||
], | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
"@semantic-release/github" | ||
] | ||
} |