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 11name : Release to GitHub Packages
22description : Release to GitHub Packages
33
4- inputs :
5- version :
6- description : ' The version of the package'
7- required : true
8-
94runs :
105 using : composite
116 steps :
127 - 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'
1816 - uses : docker/setup-qemu-action@v3
1917 - uses : docker/setup-buildx-action@v3
2018 - uses : docker/login-action@v3
2725 with :
2826 images : ghcr.io/${{ github.repository }}
2927 - id : push
30- uses : docker/build-push-action@v5
28+ uses : docker/build-push-action@v6
3129 with :
3230 context : .
3331 target : yutu
3634 labels : ${{ steps.meta.outputs.labels }}
3735 platforms : linux/amd64,linux/arm64
3836 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
4439 with :
4540 subject-name : ghcr.io/${{ github.repository }}
4641 subject-digest : ${{ steps.push.outputs.digest }}
Original file line number Diff line number Diff line change 1212 steps :
13131414 with :
15- repo-token : ${{ secrets.GITHUB_TOKEN }}
15+ repo-token : ${{ github.token }}
1616 issue-message : " Welcome to yutu, thank you for opening your first issue!"
1717 pr-message : " Welcome to yutu, thank you for opening your first PR!"
Original file line number Diff line number Diff line change 3131 - name : Upload artifact
3232 uses : actions/upload-artifact@v4
3333 with :
34- path : dist
34+ name : binary
35+ path : dist/yutu_*/yutu-*
3536
3637 attestation :
3738 needs : [goreleaser]
@@ -44,19 +45,19 @@ jobs:
4445 fail-fast : false
4546 matrix :
4647 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
5354 steps :
5455 - name : Download artifact
5556 uses : actions/download-artifact@v4
5657 with :
57- merge-multiple : true
58+ name : binary
5859 - name : Attest
59- uses : actions/attest-build-provenance@v1
60+ uses : actions/attest-build-provenance@v2
6061 with :
6162 subject-path : ' ${{ github.workspace }}/yutu_${{ matrix.path }}'
6263
7778 runs-on : macos-latest
7879 if : false
7980 steps :
80- - uses : dawidd6/action-homebrew-bump-formula@v3
81+ - uses : dawidd6/action-homebrew-bump-formula@v4
8182 with :
8283 token : ${{ secrets.RELEASE_PAT }}
8384 tag : ${{ github.event.release.tag_name }}
9596 id-token : write
9697 steps :
9798 - 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
2514ENTRYPOINT ["/usr/local/bin/yutu" ]
You can’t perform that action at this time.
0 commit comments