Skip to content

Commit

Permalink
ci: add release ci
Browse files Browse the repository at this point in the history
  • Loading branch information
CC11001100 committed Jun 27, 2023
1 parent 203f0e1 commit 94ca35a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- '*'

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
# 声明哪些是私仓
GOPRIVATE: github.com/scagogogo/*
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git config --global url.https://${{ secrets.GH_CLASS_VERSION_TRACKER_TOKEN }}@github.com/.insteadOf https://github.com/
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.2'
cache: true
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_CLASS_VERSION_TRACKER_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
24 changes: 24 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
project_name: class-version-tracker

before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- windows
- linux
goarch:
- 386
- amd64
- arm64
archives:
- name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}"
format_overrides:
- goos: windows
format: zip
snapshot:
name_template: "{{ incpatch .Version }}"

0 comments on commit 94ca35a

Please sign in to comment.