diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4bddb35..7178bb6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5b67f6d --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }}