From 278ac11b6be8c6b41f46487f75bcff354e90651f Mon Sep 17 00:00:00 2001 From: lpmatos Date: Sat, 24 Sep 2022 14:41:07 -0300 Subject: [PATCH] feat: add goreleaser --- .github/workflows/gr.yml | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/gr.yml diff --git a/.github/workflows/gr.yml b/.github/workflows/gr.yml new file mode 100644 index 0000000..ba8c6a0 --- /dev/null +++ b/.github/workflows/gr.yml @@ -0,0 +1,58 @@ +name: GoReleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + goreleaser: + name: "GoReleaser" + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v3.0.2 + with: + fetch-depth: 0 + + - name: Get Details + id: get_details + run: | + echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} + echo ::set-output name=SOURCE_TAG::$(git tag --sort=committerdate | tail -1) + echo ::set-output name=GOVERSION::$(cat .go-version) + + - name: List tags + run: | + git tag --list + + - name: Show variables + run: | + echo $SOURCE_NAME + echo $SOURCE_BRANCH + echo $SOURCE_TAG + env: + SOURCE_NAME: ${{ steps.get_details.outputs.SOURCE_NAME }} + SOURCE_BRANCH: ${{ steps.get_details.outputs.SOURCE_BRANCH }} + SOURCE_TAG: ${{ steps.get_details.outputs.SOURCE_TAG }} + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ steps.get_details.outputs.GOVERSION }} + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + args: release --rm-dist + env: + CLIENT_VERSION: ${{ steps.get_details.outputs.SOURCE_TAG }} + GO_VERSION: ${{ steps.get_details.outputs.GOVERSION }} + GORELEASER_CURRENT_TAG: ${{ steps.get_details.outputs.SOURCE_TAG }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GIT_BRANCH: ${{ steps.get_details.outputs.SOURCE_BRANCH }}