Skip to content

Commit

Permalink
add release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Viet-Anh Duong <vietanhs0817@gmail.com>
  • Loading branch information
vietanhduong committed Oct 6, 2022
1 parent f5165f7 commit a698f7c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
tags:
- v*

jobs:
prepare:
runs-on: ubuntu-18.04
outputs:
version_tag: ${{ steps.version_tag.outputs.value }}
build_date: ${{ steps.build_date.outputs.value }}
steps:
- name: Format version tag
shell: bash
id: version_tag
run: |
TAG=${GITHUB_REF#refs/*/}
echo "::set-output name=value::$TAG"
- name: Build date
shell: bash
id: build_date
run: echo "::set-output name=value::$(date +%FT%T%z)"

release:
needs:
- prepare
runs-on: ubuntu-18.04
env:
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.18.x"

- name: Release
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project_name: acme-register
builds:
- main: ./cmd/main.go
- main: ./cmd
binary: acme-register
env:
- CGO_ENABLED=0
Expand All @@ -12,9 +12,9 @@ builds:
- darwin
ldflags:
- >-
-X github.com/vietanhduong/acme-register/cmd/main.Version={{ .Tag }}
-X github.com/vietanhduong/acme-register/cmd/main.GitCommit={{ .Commit }}
-X github.com/vietanhduong/acme-register/cmd/main.BuildDate={{ .Date }}
-X main.Version={{ .Tag }}
-X main.GitCommit={{ .Commit }}
-X main.BuildDate={{ .Date }}
archives:
- files:
- LICENSE
Expand Down
Binary file added acme-register
Binary file not shown.

0 comments on commit a698f7c

Please sign in to comment.