|
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - "v*.*.*" |
7 | | - workflow_dispatch: |
8 | 7 |
|
9 | 8 | jobs: |
| 9 | + lint-and-test: |
| 10 | + name: Lint and test |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout the repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Go |
| 17 | + uses: actions/setup-go@v5 |
| 18 | + with: |
| 19 | + go-version: "1.24" |
| 20 | + |
| 21 | + - name: Cache Go modules |
| 22 | + uses: actions/cache@v4 |
| 23 | + with: |
| 24 | + path: | |
| 25 | + ~/.cache/go-build |
| 26 | + ~/go/pkg/mod |
| 27 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 28 | + restore-keys: | |
| 29 | + ${{ runner.os }}-go- |
| 30 | +
|
| 31 | + - name: Download dependencies |
| 32 | + run: go mod download |
| 33 | + |
| 34 | + - name: Run go vet |
| 35 | + run: go vet ./... |
| 36 | + |
| 37 | + - name: Run go fmt check |
| 38 | + run: | |
| 39 | + if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then |
| 40 | + echo "The following files are not formatted:" |
| 41 | + gofmt -s -l . |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | +
|
| 45 | + - name: Run tests |
| 46 | + run: go test -v ./... |
| 47 | + |
| 48 | + - name: Build check |
| 49 | + run: go build -v . |
| 50 | + |
10 | 51 | release-binaries: |
11 | | - name: Generate cross-platform builds |
| 52 | + name: Generate cross-platform builds and create release |
12 | 53 | runs-on: ubuntu-latest |
| 54 | + needs: lint-and-test |
| 55 | + permissions: |
| 56 | + contents: write |
13 | 57 | steps: |
14 | 58 | - name: Checkout the repository |
15 | 59 | uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + fetch-depth: 0 # Fetch all history for version detection |
| 62 | + |
| 63 | + - name: Set up Go |
| 64 | + uses: actions/setup-go@v5 |
| 65 | + with: |
| 66 | + go-version: "1.24" |
| 67 | + |
| 68 | + - name: Cache Go modules |
| 69 | + uses: actions/cache@v4 |
| 70 | + with: |
| 71 | + path: | |
| 72 | + ~/.cache/go-build |
| 73 | + ~/go/pkg/mod |
| 74 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 75 | + restore-keys: | |
| 76 | + ${{ runner.os }}-go- |
| 77 | +
|
| 78 | + - name: Generate build files using build script |
| 79 | + run: | |
| 80 | + chmod +x scripts/build.sh |
| 81 | + ./scripts/build.sh |
16 | 82 |
|
17 | | - - name: Generate build files |
18 | | - uses: thatisuday/go-cross-build@v1 |
| 83 | + - name: Create draft release and upload assets |
| 84 | + uses: softprops/action-gh-release@v2 |
19 | 85 | 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" |
| 86 | + draft: true |
| 87 | + files: builds/* |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
41 | 90 |
|
42 | 91 | build-and-push-docker-image: |
43 | 92 | runs-on: ubuntu-latest |
| 93 | + needs: lint-and-test |
44 | 94 |
|
45 | 95 | permissions: |
46 | 96 | contents: read |
|
65 | 115 | run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
66 | 116 |
|
67 | 117 | - name: Build and push Docker image with GHA cache |
68 | | - uses: docker/build-push-action@v5 |
| 118 | + uses: docker/build-push-action@v6 |
69 | 119 | with: |
70 | 120 | context: . |
71 | 121 | push: true |
|
0 commit comments