forked from openclarity/apiclarity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow: Add a release workflow (openclarity#10)
- Loading branch information
Showing
6 changed files
with
140 additions
and
21 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
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,88 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version | ||
required: true | ||
|
||
env: | ||
GO_VERSION: 1.16 | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Check licenses | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make license-check | ||
|
||
- name: Run verification | ||
run: make check | ||
|
||
- name: Tag validation | ||
run: | | ||
tag='${{ github.event.inputs.version }}' | ||
[[ $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 1 | ||
- name: Tag | ||
run: | | ||
tag='${{ github.event.inputs.version }}' | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
sed -i 's/image: ghcr.io\/apiclarity\/apiclarity:latest/image: ghcr.io\/apiclarity\/apiclarity:'"$tag"'/g' deployment/apiclarity.yaml | ||
git commit deployment/apiclarity.yaml -m "update tag in deployment yaml" | ||
git tag --annotate --message "Tag for release $tag" "$tag" | ||
git push origin "refs/tags/$tag" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.ref }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Push APIClarity | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
tags: ghcr.io/apiclarity/apiclarity:${{ github.event.inputs.version }} | ||
file: Dockerfile | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: v0.178.0 | ||
args: release --rm-dist | ||
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ db.db | |
backend/bin/* | ||
/bin/* | ||
*.gob | ||
goreleaser_artifacts/ |
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,46 @@ | ||
before: | ||
hooks: | ||
- git submodule init wasm-filters | ||
- git submodule update wasm-filters | ||
|
||
builds: | ||
- | ||
dir: backend | ||
main: ./cmd/backend | ||
binary: backend | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
|
||
archives: | ||
- | ||
name_template: "{{ .ProjectName }}_{{ .Version }}" | ||
|
||
# Additional files/template/globs we want to add to the archive. | ||
files: | ||
- LICENSE | ||
- README.md | ||
- wasm-filters/deploy.sh | ||
- wasm-filters/envoyFilter.yaml | ||
- wasm-filters/bin/release/http-trace-filter.wasm | ||
- deployment/apiclarity.yaml | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
# Change the default artifacts folder | ||
dist: goreleaser_artifacts | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- '^workflow:' |
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
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