Skip to content

Commit

Permalink
action: add tag release
Browse files Browse the repository at this point in the history
Signed-off-by: Date Huang <[email protected]>
  • Loading branch information
tjjh89017 committed Jan 28, 2025
1 parent 30f06c2 commit 9541834
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ jobs:
with:
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: ${{ steps.meta.outputs.tags }},${{ github.repository_owner }}/${{ env.APP }}:latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release
on:
push:
tags:
- '*'

env:
GO_VERSION: "1.22"
CGO_ENABLED: "0"
APP: "stunmesh"

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
os: [linux, darwin]
arch: [amd64, arm64, arm, mipsle]
exclude:
- os: darwin
arch: mipsle
- os: darwin
arch: arm
steps:
- uses: actions/checkout@v4
- name: tag
id: tag
run: echo "TAG=$(git describe --tags --dirty)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
run: go build -v -o ${{ env.APP}}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.tag.outputs.TAG }} .
env:
CGO_ENABLED: 0
GOARCH: ${{ matrix.arch }}
GOOS: ${{ matrix.os }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.APP }}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.tag.outputs.TAG }}

docker:
name: Build Docker container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ github.repository_owner }}/${{ env.APP }}
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: ${{ steps.meta.outputs.tags }}, latest
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 9541834

Please sign in to comment.