v0.0.1 #8
Workflow file for this run
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
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" |