From 9b47b5b72c2bd0cc7164c895f69351c4b66bdce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Marschollek?= Date: Sun, 23 Oct 2022 18:53:24 +0200 Subject: [PATCH] Add a GitHub action for release This adds a GitHub action to build and release the workflow whenever a tag is pushed that looks like a semver tag. When a release with a corresponding tag is created through the GitHub interface, this action runs. It builds and packages the workflow and then adds the workflow to the existing GitHub release. If a tag is pushed, but no GitHub release exists, it creates a new one. The title is going to be the pushed tag and the body the commit message of the commit the tag points to. Relates to: #12 --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..4a14ab7 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Publish + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' + +jobs: + release: + runs-on: ubuntu-latest + name: Build workflow + steps: + - uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + - name: Build binaries + run: | + GOOS=darwin GOARCH=arm64 go build -o dictcc_arm64 main.go + GOOS=darwin GOARCH=amd64 go build -o dictcc_amd64 main.go + - name: Bundle workflow + run: | + mkdir dist + zip dist/Dict.cc.alfredworkflow dictcc_arm64 dictcc_amd64 assets/info.plist assets/icon.png + - name: Create or update the GitHub release + uses: softprops/action-gh-release@v1 + with: + files: dist/Dict.cc.alfredworkflow