Skip to content

Commit

Permalink
build: Update GHA workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
haijima committed Mar 23, 2024
1 parent 85cb3fb commit 8526b63
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 85 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,26 @@
name: CD
on:
workflow_run:
workflows: [ CI ]
types:
- completed
branches:
- main
- develop
push:
tags:
- v*
permissions: write-all

jobs:
tag:
name: tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
release:
runs-on: ubuntu-latest
needs:
- tag
# if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache: true
- uses: goreleaser/goreleaser-action@v4
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
PAT_FOR_HOMEBREW_TAP: ${{ secrets.PAT_FOR_HOMEBREW_TAP }}
continue-on-error: true
12 changes: 5 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,22 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache: true
- name: get dependencies
run: go get -v -t -d ./...
- name: testing
Expand Down
45 changes: 31 additions & 14 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
before:
hooks:
- go mod tidy
#- go generate ./...

builds:
- main: ./main.go
binary: stool
binary: "{{ .ProjectName }}"
flags:
- -trimpath
env:
- CGO_ENABLED=0
goos:
- darwin
- freebsd
- linux
- windows
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
# use zip for windows archives
format_overrides:
- goos: windows
Expand All @@ -33,14 +28,36 @@ archives:
rlcp: true
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"

changelog:
use: github
sort: asc
groups:
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: "Performance Improvements"
regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$'
order: 2
- title: Others
order: 999
filters:
exclude:
- '^docs:'
- '^refactor:'
- '^test:'
release:
mode: keep-existing
- '^chore:'
- '^build:'

brews:
- repository:
owner: haijima
name: homebrew-tap
token: "{{ .Env.PAT_FOR_HOMEBREW_TAP }}"
folder: Formula
description: "Analyzes SQL queries"
homepage: "{{ .GitURL }}"
license: "MIT"
31 changes: 0 additions & 31 deletions .releaserc.json

This file was deleted.

0 comments on commit 8526b63

Please sign in to comment.