Skip to content

Commit 0383e26

Browse files
authored
Merge pull request #6 from wavezync/feat/build-and-push-ci
2 parents 10745c3 + 063d663 commit 0383e26

File tree

2 files changed

+85
-11
lines changed

2 files changed

+85
-11
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ name: Build
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
77
branches: [ "main","*" ]
88

99
jobs:
1010

11-
build:
11+
build-go:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v4
1515

16-
- name: Set up Go
17-
uses: actions/setup-go@v4
18-
with:
19-
go-version: '1.24'
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: '1.24'
2020

21-
- name: Build
22-
run: go build -v ./...
21+
- name: Build
22+
run: go build -v ./...
2323

24-
- name: Test
25-
run: go test -v ./...
24+
- name: Test
25+
run: go test -v ./...

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
release-binaries:
11+
name: Generate cross-platform builds
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v4
16+
17+
- name: Generate build files
18+
uses: thatisuday/go-cross-build@v1
19+
with:
20+
platforms: |
21+
linux/amd64,
22+
linux/386,
23+
linux/ppc64,
24+
linux/ppc64le,
25+
linux/mips64,
26+
linux/mips64le,
27+
darwin/amd64,
28+
windows/amd64,
29+
windows/386,
30+
freebsd/amd64,
31+
netbsd/amd64,
32+
openbsd/amd64,
33+
dragonfly/amd64,
34+
plan9/amd64,
35+
plan9/386,
36+
solaris/amd64
37+
package: ""
38+
name: "pulse-bridge"
39+
compress: "false"
40+
dest: "dist"
41+
42+
build-and-push-docker-image:
43+
runs-on: ubuntu-latest
44+
45+
permissions:
46+
contents: read
47+
packages: write
48+
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Log in to GitHub Container Registry (GHCR)
57+
uses: docker/login-action@v3
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Extract semver version
64+
id: extract_version
65+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
66+
67+
- name: Build and push Docker image with GHA cache
68+
uses: docker/build-push-action@v5
69+
with:
70+
context: .
71+
push: true
72+
tags: ghcr.io/${{ github.repository_owner }}/pulse-bridge:${{ steps.extract_version.outputs.VERSION }}
73+
cache-from: type=gha
74+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)