Skip to content

Commit 0b736d5

Browse files
authored
Merge pull request #316 from tashima42/replace-goreleaser-build
replace goreleaser action on ci
2 parents b8639a9 + 9a8f139 commit 0b736d5

File tree

1 file changed

+50
-13
lines changed

1 file changed

+50
-13
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
name: CI
2-
32
on:
43
pull_request:
5-
64
jobs:
75
test:
86
runs-on: ubuntu-latest
97
steps:
108
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
11-
129
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
1310
with:
1411
go-version-file: go.mod
1512

1613
- name: Run Tests(unit, canary, integration)
1714
run: go test ./...
18-
1915
lint:
2016
runs-on: ubuntu-latest
2117
steps:
@@ -29,17 +25,58 @@ jobs:
2925
version: latest
3026
install-mode: goinstall
3127
only-new-issues: true
32-
3328
build:
3429
runs-on: ubuntu-latest
3530
steps:
36-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
32+
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
33+
with:
34+
go-version-file: go.mod
35+
- name: Setup goreleaser
36+
shell: bash
37+
run: |-
38+
OS="Linux"
39+
if [[ ${RUNNER_OS} != "Linux" ]]; then
40+
echo "Unsupported OS: ${RUNNER_OS}"
41+
exit 1
42+
fi
43+
44+
# renovate-local: goreleaser-x86_64
45+
GORELEASER_VERSION="v2.15.2"
46+
# renovate-local: goreleaser-x86_64=v2.15.2
47+
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"
48+
49+
ARCH=$(uname -m)
50+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
51+
if [[ "${ARCH}" != "x86_64" ]]; then
52+
echo "Unsupported architecture: ${ARCH}"
53+
exit 1
54+
fi
55+
56+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
3757
38-
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
39-
with:
40-
go-version-file: go.mod
58+
echo "Installing ${FILE}"
59+
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
60+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
61+
tar -xf "${FILE}" goreleaser
4162
42-
- name: Run goreleaser
43-
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
44-
with:
45-
args: build --snapshot
63+
if sudo -n true &> /dev/null; then
64+
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
65+
else
66+
install -m 755 goreleaser /usr/local/bin/goreleaser
67+
fi
68+
rm -f "${FILE}" goreleaser
69+
- name: Run goreleaser
70+
shell: bash
71+
run: |-
72+
goreleaser build --snapshot
73+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
74+
echo "Missing required file: dist/metadata.json"
75+
exit 1
76+
fi
77+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
78+
echo "Missing required file: dist/artifacts.json"
79+
exit 1
80+
fi
81+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
82+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"

0 commit comments

Comments
 (0)