-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f413f63
commit 789c9f9
Showing
4 changed files
with
99 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Release to GitHub Packages | ||
description: Release to GitHub Packages | ||
|
||
inputs: | ||
version: | ||
description: 'The version of the package' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: ldflags | ||
shell: bash | ||
run: | | ||
echo "commit-date=$(git log -1 --date='format:%Y-%m-%d/%H.%M.%S' --pretty=%cd)" >> "$GITHUB_OUTPUT" | ||
echo "commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | ||
- uses: docker/setup-qemu-action@v3 | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/#-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
- id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
- id: push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
target: yutu | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
provenance: true | ||
build-args: | | ||
version=${{ inputs.version }} | ||
commit=${{ steps.ldflags.outputs.commit }} | ||
commit-date=${{ steps.ldflags.outputs.commit-date }} | ||
# - uses: actions/attest-build-provenance@v1 | ||
# with: | ||
# subject-name: ghcr.io/${{ github.repository }} | ||
# subject-digest: ${{ steps.push.outputs.digest }} | ||
# push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM golang:alpine as builder | ||
ARG commit | ||
ARG commitDate | ||
ARG version | ||
|
||
ENV MOD="github.com/eat-pray-ai/yutu/cmd" | ||
WORKDIR /app | ||
COPY . . | ||
|
||
RUN Version="${MOD}.Version=${version}" \ | ||
Commit="${MOD}.Commit=${commit}" \ | ||
CommitDate="${MOD}.CommitDate=${commitDate}" \ | ||
Os="${MOD}.Os=linux" \ | ||
Arch="${MOD}.Arch=$(go env GOARCH)" \ | ||
ldflags="-s -X ${Version} -X ${Commit} -X ${CommitDate} -X ${Os} -X ${Arch}" \ | ||
&& export ldflags \ | ||
&& go mod download \ | ||
&& go build -ldflags "${ldflags}" -o yutu . | ||
|
||
FROM alpine:latest as yutu | ||
|
||
COPY --from=builder /app/yutu /usr/local/bin/yutu | ||
RUN chmod +x /usr/local/bin/yutu | ||
|
||
ENTRYPOINT ["/usr/local/bin/yutu"] |