Skip to content

Commit

Permalink
Merge pull request #43 from ponkio-o/feat/added-goreleaser
Browse files Browse the repository at this point in the history
feat: added GoRereleaser
  • Loading branch information
Kuniwak authored May 11, 2024
2 parents dc7522d + 2c1726d commit a2c9ff8
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 116 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,42 @@ jobs:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

release-binaries:
name: Build and release binaries
runs-on: ubuntu-latest
permissions:
# Required to write release assets
contents: write

steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
submodules: recursive

- name: Install aqua
uses: aquaproj/aqua-installer@4551ec64e21bf0f557c2525135ff0bd2cba40ec7 # v3.0.0
with:
aqua_version: v2.27.3

- uses: nowsprinting/check-version-format-action@98485692a883d962227b09f40f29a63de0771299 # v4.0.2
id: version
with:
prefix: "v"

- name: Create pre-release
if: steps.version.outputs.is_stable != 'true'
run: gh release create --prerelease --title ${{ github.ref_name }} ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create release
if: steps.version.outputs.is_stable == 'true'
run: gh release create --latest --title ${{ github.ref_name }} ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run goreleaser
run: goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tmp
dist
out
.env
# Created by https://www.toptal.com/developers/gitignore/api/go
Expand Down
89 changes: 89 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
version: 1

builds:
- id: unity-meta-check
binary: unity-meta-check
main: ./main.go
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- id: unity-meta-check-junit
binary: unity-meta-check-junit
main: ./tool/unity-meta-check-junit
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- id: gh-action
binary: gh-action
main: ./tool/gh-action
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
- id: gh-action-yaml-gen
binary: gh-action-yaml-gen
main: ./tool/gh-action/action-yaml-gen
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- id: unity-meta-autofix
binary: unity-meta-autofix
main: ./tool/unity-meta-autofix
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- id: unity-meta-check-github-pr-comment
binary: unity-meta-check-github-pr-comment
main: ./tool/unity-meta-check-github-pr-comment
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64

archives:
- format: binary
name_template: >-
{{ .Binary }}-
{{- if eq .Os "Darwin" }}darwin-
{{- else if eq .Os "Linux" }}linux-
{{- else }}{{ .Os }}{{ end }}-{{ .Arch }}
# https://goreleaser.com/errors/multiple-binaries-archive/
allow_different_binary_count: true

checksum:
name_template: "checksums.txt"

release:
prerelease: auto
14 changes: 14 additions & 0 deletions aqua.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
# checksum:
# enabled: true
# require_checksum: true
# supported_envs:
# - all
registries:
- type: standard
ref: v4.166.0 # renovate: depName=aquaproj/aqua-registry
packages:
- name: goreleaser/[email protected]
- name: cli/[email protected]
4 changes: 0 additions & 4 deletions scripts/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ usage-error() {

main() {
has go || throw "'go' must be installed (see https://golang.org)"
has gh || throw "'gh' must be installed (see https://cli.github.com)"
has docker || throw "'docker' must be installed (see https://www.docker.com)"

local version
version="$("$BASE_DIR/scripts/print-version")"

gh auth status
go test ./...

local tag="v${version}"
Expand All @@ -60,7 +57,6 @@ main() {
git tag "$tag"

(cd "$BASE_DIR"
./scripts/deploy-gh-release
./scripts/deploy-bins
)
}
Expand Down
108 changes: 0 additions & 108 deletions scripts/deploy-gh-release

This file was deleted.

4 changes: 0 additions & 4 deletions scripts/is-prerelease

This file was deleted.

0 comments on commit a2c9ff8

Please sign in to comment.