2021-05-05 05:57:33 +08:00
|
|
|
name: release
|
2021-08-10 00:07:26 +08:00
|
|
|
on:
|
2021-05-05 05:57:33 +08:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
2021-08-31 02:06:20 +08:00
|
|
|
env:
|
2022-03-30 04:10:32 +08:00
|
|
|
GO_VERSION: 1.18
|
2021-08-31 02:06:20 +08:00
|
|
|
|
2021-05-05 05:57:33 +08:00
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-14 23:14:32 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-05-05 05:57:33 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-03-20 11:31:00 +08:00
|
|
|
- uses: actions/setup-go@v4
|
2021-05-05 05:57:33 +08:00
|
|
|
with:
|
2021-08-31 02:06:20 +08:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2022-04-20 03:43:30 +08:00
|
|
|
check-latest: true
|
2022-03-29 04:05:07 +08:00
|
|
|
- uses: actions/cache@v3
|
2021-05-05 05:57:33 +08:00
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
- name: GoReleaser
|
2022-12-19 23:46:21 +08:00
|
|
|
uses: goreleaser/goreleaser-action@v4
|
2021-05-05 05:57:33 +08:00
|
|
|
with:
|
2021-10-25 00:36:09 +08:00
|
|
|
version: latest
|
2022-06-21 08:02:49 +08:00
|
|
|
args: release --rm-dist
|
2021-05-05 05:57:33 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
|
|
|
|
- name: Chocolatey
|
|
|
|
uses: ./.github/actions/choco
|
|
|
|
with:
|
|
|
|
version: ${{ github.ref }}
|
|
|
|
apiKey: ${{ secrets.CHOCO_APIKEY }}
|
2021-12-09 02:49:33 +08:00
|
|
|
push: true
|
2023-01-21 02:22:58 +08:00
|
|
|
- name: GitHub CLI extension
|
2023-01-23 10:56:38 +08:00
|
|
|
uses: actions/github-script@v6
|
2023-01-21 02:22:58 +08:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
|
|
|
|
script: |
|
|
|
|
const mainRef = (await github.rest.git.getRef({
|
|
|
|
owner: 'nektos',
|
|
|
|
repo: 'gh-act',
|
|
|
|
ref: 'heads/main',
|
|
|
|
})).data;
|
|
|
|
console.log(mainRef);
|
|
|
|
github.rest.git.createRef({
|
|
|
|
owner: 'nektos',
|
|
|
|
repo: 'gh-act',
|
2023-02-01 10:55:22 +08:00
|
|
|
ref: context.ref,
|
2023-01-21 02:22:58 +08:00
|
|
|
sha: mainRef.object.sha,
|
|
|
|
});
|
2023-02-14 01:59:19 +08:00
|
|
|
winget:
|
|
|
|
needs: release
|
|
|
|
runs-on: windows-latest # Action can only run on Windows
|
|
|
|
steps:
|
|
|
|
- uses: vedantmgoyal2009/winget-releaser@v2
|
|
|
|
with:
|
|
|
|
identifier: nektos.act
|
|
|
|
installers-regex: '_Windows_\w+\.zip$'
|
|
|
|
token: ${{ secrets.WINGET_TOKEN }}
|