-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit c9bd450
Showing
256 changed files
with
56,463 additions
and
0 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,90 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build-and-deploy-docker: | ||
name: Build and Deploy | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: olegtarasov/[email protected] | ||
id: tag-name | ||
|
||
- name: Get Git Info | ||
id: git_info | ||
run: | | ||
last_commit_time=$(git log -1 --format=%cd --date=iso) | ||
echo "last_commit_time=$last_commit_time" >> $GITHUB_ENV | ||
echo "Last commit time is $last_commit_time" | ||
last_commit_message=$(git log -1 --format=%B) | ||
echo "last_commit_message=$last_commit_message" >> $GITHUB_ENV | ||
echo "Last commit message is $last_commit_message" | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
build-args: | | ||
VERSION=${{ env.GIT_TAG_NAME }} | ||
COMMIT_TIME=${{ env.last_commit_time }} | ||
COMMIT_MESSAGE="${{ env.last_commit_message }}" | ||
labels: | | ||
org.opencontainers.image.version=${{ env.GIT_TAG_NAME }} | ||
org.opencontainers.image.created=${{ env.last_commit_time }} | ||
org.opencontainers.image.revision="${{ env.last_commit_message }}" | ||
tags: | | ||
ghcr.io/${{ github.repository }}:latest | ||
ghcr.io/${{ github.repository }}:${{ env.GIT_TAG_NAME }} | ||
releases-matrix: | ||
name: Release Go Binary | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux, windows, darwin] | ||
goarch: [amd64, arm64] | ||
exclude: | ||
- goarch: "arm64" | ||
goos: windows | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get Git Info | ||
id: git_info | ||
run: | | ||
last_commit_time=$(git log -1 --format=%cd --date=iso) | ||
echo "last_commit_time=$last_commit_time" >> $GITHUB_ENV | ||
echo "Last commit time is $last_commit_time" | ||
last_commit_message=$(git log -1 --format=%B) | ||
echo "last_commit_message=$last_commit_message" >> $GITHUB_ENV | ||
echo "Last commit message is $last_commit_message" | ||
- uses: wangyoucao577/go-release-action@v1 | ||
env: | ||
RELEASE_NAME: ${{ env.GIT_TAG_NAME }} | ||
with: | ||
github_token: ${{ secrets.TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
goversion: "https://dl.google.com/go/go1.22.0.linux-amd64.tar.gz" | ||
project_path: "./cmd" | ||
executable_compression: upx | ||
sha256sum: true | ||
ldflags: "-X 'main.version=${{ env.GIT_TAG_NAME }}' -X 'main.commitMessage=${{env.last_commit_message}}' -X 'main.commitTime=${{env.last_commit_time}}' -s -w -extldflags '-static'" | ||
binary_name: "omni-balance" |
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,45 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: ["*"] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Golang with cache | ||
uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version-file: go.mod | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
args: --timeout=10m | ||
gitleaks: | ||
name: gitleaks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: init gitleaks | ||
run: | | ||
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.0/gitleaks_8.18.0_linux_x64.tar.gz | ||
tar -zxvf gitleaks_8.18.0_linux_x64.tar.gz -C /tmp/ | ||
sudo mv /tmp/gitleaks /usr/local/bin/ | ||
- name: gitleaks | ||
run: | | ||
gitleaks detect -v --redact --no-git -i ./.gitleaksignore | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Golang with cache | ||
uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Test | ||
run: go test -v ./... |
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,5 @@ | ||
.idea | ||
.vscode | ||
local | ||
.run | ||
./config.yaml |
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:1.22.3-alpine as builder | ||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
ARG VERSION | ||
ARG COMMIT_MESSAGE | ||
ARG COMMIT_TIME | ||
|
||
COPY . . | ||
# garble build | ||
RUN CGO_ENABLED=0 go build -a -ldflags \ | ||
"-X 'main.version=$VERSION' \ | ||
-X 'main.commitMessage=$COMMIT_MESSAGE' \ | ||
-X 'main.commitTime=$COMMIT_TIME' -s -w -extldflags '-static'" \ | ||
-o omni-balance ./cmd | ||
|
||
FROM gruebel/upx:latest as upx | ||
COPY --from=builder /app/omni-balance /omni-balance | ||
RUN upx --best --lzma /omni-balance | ||
|
||
FROM alpine:latest as prod | ||
COPY --from=upx /omni-balance /omni-balance | ||
ENTRYPOINT ["/omni-balance"] |
Oops, something went wrong.