forked from vultr/govultr
-
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.
Add autoreleaser workflow (vultr#194)
- Loading branch information
1 parent
b9ceb1a
commit 0c1ce29
Showing
3 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: "Automatic Releaser" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
check-commit: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
msg_check: ${{ steps.check-msg.outputs.match }} | ||
steps: | ||
- name: Check Message | ||
id: check-msg | ||
run: | | ||
pattern="^Release v[0-9].[0-9].[0-9] #(minor|major|patch)$" | ||
if [[ "${{ github.event.head_commit.message }}" =~ ${pattern} ]]; then | ||
echo ::set-output name=match::true | ||
fi | ||
create-tag: | ||
runs-on: ubuntu-latest | ||
if: needs.check-commit.outputs.msg_check == 'true' | ||
needs: check-commit | ||
outputs: | ||
new_tag: ${{ steps.tagger.outputs.new_tag }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: Bump version and push tag | ||
id: tagger | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: "none" | ||
|
||
goreleaser: | ||
runs-on: ubuntu-latest | ||
needs: create-tag | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: ["goreleaser", "create-tag"] | ||
name: Release Notification | ||
steps: | ||
- run: | | ||
echo "{\"text\":\"GoVultr : Release https://github.com/${{ github.repository }}/releases/tag/${{ needs.create-tag.outputs.new_tag }} \"}" > mattermost.json | ||
- uses: mattermost/action-mattermost-notify@master | ||
env: | ||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} | ||
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}} | ||
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
- go generate ./... | ||
builds: | ||
- skip: true | ||
|
||
checksum: | ||
name_template: "{{ .ProjectName }}_v{{ .Version }}_checksums.txt" | ||
algorithm: sha256 | ||
|
||
snapshot: | ||
name_template: "{{ .ProjectName }}_v{{ .Version }}" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
release: | ||
github: | ||
owner: Vultr | ||
name: govultr |