Skip to content

Commit aca3189

Browse files
committed
fix: ci
1 parent 8b5baab commit aca3189

1 file changed

Lines changed: 29 additions & 46 deletions

File tree

.github/workflows/release.yaml

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,76 +21,59 @@ env:
2121
jobs:
2222
binaries:
2323
strategy:
24+
fail-fast: false
2425
matrix:
25-
os:
26-
- ubuntu-latest
27-
- macos-latest
28-
arch:
29-
- amd64
30-
- arm64
31-
runs-on: ${{ matrix.os }}
26+
include:
27+
- runner: fixed-egress-4c-16g
28+
os_name: linux
29+
arch: amd64
30+
- runner: fixed-egress-4c-16g
31+
os_name: linux
32+
arch: arm64
33+
- runner: macos-latest
34+
os_name: darwin
35+
arch: amd64
36+
- runner: macos-latest
37+
os_name: darwin
38+
arch: arm64
39+
runs-on: ${{ matrix.runner }}
3240
env:
3341
ARCH_NAME: ${{ matrix.arch }}
42+
OS_NAME: ${{ matrix.os_name }}
3443
steps:
3544
- name: Checkout code
3645
uses: actions/checkout@v5
3746

38-
- name: Export Variables
39-
id: export-variables
40-
run: |
41-
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
42-
echo "os_name=linux" >> $GITHUB_OUTPUT
43-
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
44-
echo "os_name=darwin" >> $GITHUB_OUTPUT
45-
fi
46-
47-
- name: Install dependencies
48-
run: |
49-
if [ "$OS_NAME" == "linux" ]; then
50-
sudo apt-get update
51-
if [ "${{ matrix.arch }}" == "amd64" ]; then
52-
sudo apt-get install -y build-essential
53-
elif [ "${{ matrix.arch }}" == "arm64" ]; then
54-
sudo apt install -y build-essential gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
55-
fi
56-
elif [ "$OS_NAME" == "darwin" ]; then
57-
brew update
58-
brew install sqlite
59-
fi
60-
env:
61-
OS_NAME: ${{ steps.export-variables.outputs.os_name }}
6247

6348
- name: Set up Go
6449
uses: actions/setup-go@v6
6550
with:
6651
go-version: 1.26
6752

68-
- name: Build ${{matrix.os}}-${{matrix.arch}} binary
53+
- name: Build ${{ matrix.os_name }}-${{ matrix.arch }} binary
6954
id: build
55+
shell: bash
7056
run: |
57+
set -euo pipefail
58+
7159
OUTPUT_NAME="${{ env.BINARY_NAME }}_${{ github.event.inputs.tag || github.ref_name }}_${OS_NAME}_${ARCH_NAME}"
72-
OUTPUT_DIR=dist/${OUTPUT_NAME}
60+
OUTPUT_DIR="dist/${OUTPUT_NAME}"
7361
ARCHIVE_NAME="${OUTPUT_NAME}.tar.gz"
62+
ARCHIVE_PATH="${OUTPUT_DIR}/${ARCHIVE_NAME}"
7463
75-
echo "output_dir=${OUTPUT_DIR}" >> $GITHUB_OUTPUT
76-
mkdir -p ${OUTPUT_DIR}
64+
echo "archive_path=${ARCHIVE_PATH}" >> "$GITHUB_OUTPUT"
65+
mkdir -p "${OUTPUT_DIR}"
7766
78-
if [ "${OS_NAME}" = "linux" ] && [ "${ARCH_NAME}" = "arm64" ]; then
79-
export CC=aarch64-linux-gnu-gcc
80-
export CXX=aarch64-linux-gnu-g++
81-
fi
67+
CGO_ENABLED=0 GOOS="$OS_NAME" GOARCH="$ARCH_NAME" \
68+
go build -ldflags="-s -w" -o "${OUTPUT_DIR}/${{ env.BINARY_NAME }}" cmd/watcher/main.go
8269
83-
CGO_ENABLED=1 GOOS=$OS_NAME GOARCH=$ARCH_NAME \
84-
go build -ldflags="-s -w" -o ${OUTPUT_DIR}/${{ env.BINARY_NAME }} cmd/watcher/main.go
85-
tar -czvf ${OUTPUT_DIR}/${ARCHIVE_NAME} -C ${OUTPUT_DIR} ${{ env.BINARY_NAME }}
86-
env:
87-
OS_NAME: ${{ steps.export-variables.outputs.os_name }}
70+
tar -czvf "${ARCHIVE_PATH}" -C "${OUTPUT_DIR}" "${{ env.BINARY_NAME }}"
8871
8972
- name: Upload binary artifact
9073
uses: actions/upload-artifact@v4
9174
with:
92-
name: binary-${{ steps.export-variables.outputs.os_name }}-${{ matrix.arch }}
93-
path: "${{ steps.build.outputs.output_dir }}/*.tar.gz"
75+
name: binary-${{ matrix.os_name }}-${{ matrix.arch }}
76+
path: ${{ steps.build.outputs.archive_path }}
9477
if-no-files-found: error
9578
retention-days: 1
9679

0 commit comments

Comments
 (0)