-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.12 KB
/
release-cli.yml
File metadata and controls
78 lines (66 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Release CLI
on:
push:
tags:
- "cli-v*"
permissions:
contents: write
jobs:
release:
name: Build and Release CLI
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Prepare version tag
env:
GIT_TAG: ${{ github.ref_name }}
run: |
# Goreleaser derives archive names from the tag. Create a local-only
# semver tag so filenames stay hover_0.1.3_os_arch.
SEMVER_TAG="${GIT_TAG#cli-}"
git tag -f "$SEMVER_TAG" HEAD
echo "SEMVER_TAG=$SEMVER_TAG" >> $GITHUB_ENV
- uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ env.SEMVER_TAG }}
- name: Create GitHub release under cli-v tag
env:
GIT_TAG: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${GIT_TAG#cli-}"
gh release create "$GIT_TAG" \
--title "CLI ${VERSION#v}" \
--notes "CLI release ${GIT_TAG}" \
--prerelease \
dist/hover_*.tar.gz dist/hover_*.zip dist/checksums.txt
- name: Load secrets from 1Password
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
NPM_TOKEN: op://Good Native/npm/npm_access_token
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Publish to npm
working-directory: npm
env:
GIT_TAG: ${{ github.ref_name }}
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
run: |
VERSION="${GIT_TAG#cli-v}"
cp ../npm-README.md README.md
npm version "$VERSION" --no-git-tag-version
npm publish --access public