-
Notifications
You must be signed in to change notification settings - Fork 124
89 lines (74 loc) · 2.31 KB
/
release.yml
File metadata and controls
89 lines (74 loc) · 2.31 KB
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
permissions:
contents: write
packages: write
pages: write
deployments: write
pull-requests: write
issues: write
on:
release:
types: [created]
jobs:
goreleaser:
if: true # false to skip job during debug
runs-on: ubuntu-latest
steps:
- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.24'
- name: Check out code into the Go module directory
uses: actions/checkout@v5
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Setup Protobuf
uses: ./.github/actions/setup-protobuf
- name: Generate protobuf files
run: go generate ./api/pb/
- name: Release via goreleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
name: Build and Push Docker Images
if: true # false to skip job during debug
strategy:
fail-fast: false
matrix:
image: [
{file: 'docker/Dockerfile', name: 'cybertecpostgresql/pgwatch'},
{file: 'docker/demo/Dockerfile', name: 'cybertecpostgresql/pgwatch-demo'}
]
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v5
- name: Prepare build metadata
id: meta
run: |
echo "GIT_HASH=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "GIT_TIME=$(git show -s --format=%cI HEAD)" >> $GITHUB_OUTPUT
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "SHOULD_PUSH=${{ github.ref_type == 'tag' }}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: ./.github/actions/build-docker
with:
dockerfile: ${{ matrix.image.file }}
image-name: ${{ matrix.image.name }}
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
platforms: linux/amd64,linux/arm64
push: ${{ steps.meta.outputs.SHOULD_PUSH }}
cache-scope: shared-release
build-args: |
GIT_HASH=${{ steps.meta.outputs.GIT_HASH }}
GIT_TIME=${{ steps.meta.outputs.GIT_TIME }}
VERSION=${{ steps.meta.outputs.VERSION }}