File tree Expand file tree Collapse file tree 4 files changed +36
-53
lines changed Expand file tree Collapse file tree 4 files changed +36
-53
lines changed Original file line number Diff line number Diff line change 1
1
name : Release to GitHub Packages
2
2
description : Release to GitHub Packages
3
3
4
- inputs :
5
- version :
6
- description : ' The version of the package'
7
- required : true
8
-
9
4
runs :
10
5
using : composite
11
6
steps :
12
7
- uses : actions/checkout@v4
13
- - id : ldflags
14
- shell : bash
15
- run : |
16
- echo "commit-date=$(git log -1 --date='format:%Y-%m-%d/%H.%M.%S' --pretty=%cd)" >> "$GITHUB_OUTPUT"
17
- echo "commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
8
+ with :
9
+ sparse-checkout : |
10
+ Dockerfile
11
+ sparse-checkout-cone-mode : false
12
+ - uses : actions/download-artifact@v4
13
+ with :
14
+ name : binary
15
+ path : ' ${{ github.workspace }}/dist'
18
16
- uses : docker/setup-qemu-action@v3
19
17
- uses : docker/setup-buildx-action@v3
20
18
- uses : docker/login-action@v3
27
25
with :
28
26
images : ghcr.io/${{ github.repository }}
29
27
- id : push
30
- uses : docker/build-push-action@v5
28
+ uses : docker/build-push-action@v6
31
29
with :
32
30
context : .
33
31
target : yutu
36
34
labels : ${{ steps.meta.outputs.labels }}
37
35
platforms : linux/amd64,linux/arm64
38
36
provenance : true
39
- build-args : |
40
- version=${{ inputs.version }}
41
- commit=${{ steps.ldflags.outputs.commit }}
42
- commitDate=${{ steps.ldflags.outputs.commit-date }}
43
- - uses : actions/attest-build-provenance@v1
37
+ sbom : true
38
+ - uses : actions/attest-build-provenance@v2
44
39
with :
45
40
subject-name : ghcr.io/${{ github.repository }}
46
41
subject-digest : ${{ steps.push.outputs.digest }}
Original file line number Diff line number Diff line change 12
12
steps :
13
13
14
14
with :
15
- repo-token : ${{ secrets.GITHUB_TOKEN }}
15
+ repo-token : ${{ github.token }}
16
16
issue-message : " Welcome to yutu, thank you for opening your first issue!"
17
17
pr-message : " Welcome to yutu, thank you for opening your first PR!"
Original file line number Diff line number Diff line change 31
31
- name : Upload artifact
32
32
uses : actions/upload-artifact@v4
33
33
with :
34
- path : dist
34
+ name : binary
35
+ path : dist/yutu_*/yutu-*
35
36
36
37
attestation :
37
38
needs : [goreleaser]
@@ -44,19 +45,19 @@ jobs:
44
45
fail-fast : false
45
46
matrix :
46
47
path :
47
- - darwin_amd64_v1/yutu
48
- - darwin_arm64 /yutu
49
- - linux_amd64_v1/yutu
50
- - linux_arm64 /yutu
51
- - windows_amd64_v1/yutu.exe
52
- - windows_arm64 /yutu.exe
48
+ - darwin_amd64_v1/yutu-darwin-amd64
49
+ - darwin_arm64_v8.0 /yutu-darwin-arm64
50
+ - linux_amd64_v1/yutu-linux-amd64
51
+ - linux_arm64_v8.0 /yutu-linux-arm64
52
+ - windows_amd64_v1/yutu-windows-amd64 .exe
53
+ - windows_arm64_v8.0 /yutu-windows-arm64 .exe
53
54
steps :
54
55
- name : Download artifact
55
56
uses : actions/download-artifact@v4
56
57
with :
57
- merge-multiple : true
58
+ name : binary
58
59
- name : Attest
59
- uses : actions/attest-build-provenance@v1
60
+ uses : actions/attest-build-provenance@v2
60
61
with :
61
62
subject-path : ' ${{ github.workspace }}/yutu_${{ matrix.path }}'
62
63
77
78
runs-on : macos-latest
78
79
if : false
79
80
steps :
80
- - uses : dawidd6/action-homebrew-bump-formula@v3
81
+ - uses : dawidd6/action-homebrew-bump-formula@v4
81
82
with :
82
83
token : ${{ secrets.RELEASE_PAT }}
83
84
tag : ${{ github.event.release.tag_name }}
95
96
id-token : write
96
97
steps :
97
98
- uses : eat-pray-ai/yutu/.github/actions/github-packages@main
98
- with :
99
- version : ${{ github.event.release.tag_name }}
Original file line number Diff line number Diff line change 1
- FROM golang:alpine as builder
2
- ARG commit
3
- ARG commitDate
4
- ARG version
5
-
6
- ENV MOD="github.com/eat-pray-ai/yutu/cmd"
7
- WORKDIR /app
8
- COPY . .
9
-
10
- RUN Version="${MOD}.Version=${version}" \
11
- Commit="${MOD}.Commit=${commit}" \
12
- CommitDate="${MOD}.CommitDate=${commitDate}" \
13
- Os="${MOD}.Os=linux" \
14
- Arch="${MOD}.Arch=$(go env GOARCH)" \
15
- ldflags="-s -X ${Version} -X ${Commit} -X ${CommitDate} -X ${Os} -X ${Arch}" \
16
- && export ldflags \
17
- && go mod download \
18
- && go build -ldflags "${ldflags}" -o yutu .
19
-
20
- FROM alpine:latest as yutu
21
-
22
- COPY --from=builder /app/yutu /usr/local/bin/yutu
23
- RUN chmod +x /usr/local/bin/yutu
24
-
1
+ FROM alpine:latest AS binary
2
+ ARG TARGETARCH
3
+
4
+ COPY dist /app/
5
+ RUN if [[ "${TARGETARCH}" == "arm64" ]]; then \
6
+ mv /app/yutu_linux_arm64_v8.0/yutu-linux-arm64 /app/yutu; \
7
+ elif [[ "${TARGETARCH}" == "amd64" ]]; then \
8
+ mv /app/yutu_linux_amd64_v1/yutu-linux-amd64 /app/yutu; \
9
+ fi && \
10
+ chmod +x /app/yutu
11
+
12
+ FROM scratch AS yutu
13
+ COPY --from=binary /app/yutu /usr/local/bin/yutu
25
14
ENTRYPOINT ["/usr/local/bin/yutu" ]
You can’t perform that action at this time.
0 commit comments