Skip to content

Commit

Permalink
improve test and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed May 4, 2023
1 parent 6258337 commit 859f269
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:

permissions:
contents: read

jobs:
test:
name: Test
Expand All @@ -14,7 +17,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.x
- name: Test
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Release
Expand All @@ -13,20 +16,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.x
- name: Cross build
run: make cross
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
- name: Upload
run: make upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.ref_name }}
artifacts: 'goxz/*'
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,3 @@ bump: $(GOBIN)/gobump
git commit -am "bump up version to $(VERSION)"
git tag "v$(VERSION)"
git push --atomic origin main tag "v$(VERSION)"

.PHONY: upload
upload: $(GOBIN)/ghr
ghr "v$(VERSION)" goxz

$(GOBIN)/ghr:
go install github.com/tcnksm/ghr@latest

0 comments on commit 859f269

Please sign in to comment.