Repository navigation
55 lines (52 loc) 路 1.52 KB
/
Copy pathrelease.yml
File metadata and controls
55 lines (52 loc) 路 1.52 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
name: 馃摝 Release
on:
workflow_call:
inputs:
tag:
type: string
required: true
workflow_dispatch:
inputs:
tag:
description: Tag to release
type: string
required: true
permissions:
contents: read
jobs:
release:
name: 馃摝 Build and publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.tag }}
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- name: Match the version to the tag
env:
TAG: ${{ inputs.tag }}
run: npm version "$TAG" --no-git-tag-version --allow-same-version
- name: Pack the server
env:
TAG: ${{ inputs.tag }}
run: |
tar -czf "token-usage-dashboard-$TAG.tar.gz" build bin package.json package-lock.json .env.example
echo "Run it with: npm ci --omit=dev && npm start" >> "$GITHUB_STEP_SUMMARY"
- name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
gh release create "$TAG" "token-usage-dashboard-$TAG.tar.gz" \
--title "$TAG" \
--generate-notes \
--repo "$GITHUB_REPOSITORY"
echo "Released $TAG" >> "$GITHUB_STEP_SUMMARY"