forked from tarampampam/webhook-tester
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (71 loc) · 2.84 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: release
on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
types: [published]
jobs:
build-app:
name: 🏗️ Build the app (${{ matrix.os }} / ${{ matrix.arch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [linux, windows, darwin]
arch: [amd64]
steps:
- uses: actions/checkout@v4
- uses: gacts/setup-node-with-cache@v1
with: {node-version: 19}
- run: npm ci --no-audit && npm run generate
working-directory: ./web
- run: npm run build
working-directory: ./web
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}
- run: |
go install "github.com/deepmap/oapi-codegen/cmd/[email protected]"
go generate ./...
- {uses: gacts/github-slug@v1, id: slug}
- name: Generate builder values
id: values
run: echo "binary-name=webhook-tester-${{ matrix.os }}-${{ matrix.arch }}`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`" >> $GITHUB_OUTPUT
- env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
LDFLAGS: -s -w -X gh.tarampamp.am/webhook-tester/internal/version.version=${{ steps.slug.outputs.version }}
run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/webhook-tester/
- name: Upload binary file to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.values.outputs.binary-name }}
asset_name: ${{ steps.values.outputs.binary-name }}
tag: ${{ github.ref }}
build-docker-image:
name: 🏗️ Build the docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- {uses: gacts/github-slug@v1, id: slug}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: "APP_VERSION=${{ steps.slug.outputs.version }}"
tags: |
tarampampam/webhook-tester:${{ steps.slug.outputs.version }}
tarampampam/webhook-tester:latest
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.version }}
ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}:latest