-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba1d065
commit 0a93c1a
Showing
1 changed file
with
14 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,28 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Tag of the new release" | ||
required: true | ||
push: | ||
# run only against tags | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
goos: [linux, darwin] | ||
arch: [amd64, arm64] | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: './go.mod' | ||
- name: Download & verify dependencies | ||
run: go mod download && go mod verify | ||
- name: Build | ||
env: | ||
GOOS: ${{ matrix.goos }} | ||
GOARCH: ${{ matrix.arch }} | ||
run: go build -o x-${{ inputs.tag }}-${{ matrix.goos }}-${{ matrix.arch }} cmd/main/main.go | ||
- uses: actions/upload-artifact@v3 | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
name: binaries | ||
path: ./x-${{ inputs.tag }}-${{ matrix.goos }}-${{ matrix.arch }} | ||
if-no-files-found: error | ||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
x_binaries: ${{ steps.files.outputs.x_binaries }} | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: binaries | ||
- name: Build binary list | ||
id: files | ||
run: | | ||
x_binaries=$(ls -R | grep x-) | ||
delimiter="$(openssl rand -hex 8)" | ||
echo "x_binaries<<${delimiter}" >> "${GITHUB_OUTPUT}" | ||
echo "${x_binaries}" >> "${GITHUB_OUTPUT}" | ||
echo "${delimiter}" >> "${GITHUB_OUTPUT}" | ||
- name: create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
generate_release_notes: true | ||
tag_name: ${{ inputs.tag }} | ||
files: | | ||
${{ steps.files.outputs.x_binaries }} | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} |