-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 2.03 KB
/
github-actions-release.yml
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
name: publish
run-name: "Publish ${{ github.event.inputs.version }} 🤖"
on:
workflow_dispatch:
inputs:
version:
description: 'Updated registry version'
required: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Validate version format
run: |
if [[ ! ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version '${{ github.event.inputs.version }}' is not a valid semver version."
exit 1
fi
- name: Checkout repository source
uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Configure git
run: |
git config --global user.name "Kruithne"
git config --global user.email "[email protected]"
- name: Install dependencies
run: bun install
- name: Update package version to ${{ github.event.inputs.version }}
run: npm version ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }} ✨"
- name: Push version tag to GitHub
run: git push --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package to npmjs.org
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create release tarball
run: npm pack --output=release-${{ github.event.inputs.version }}.tgz
- name: Upload release package to GitHub
uses: softprops/action-gh-release@v1
with:
files: |
release-${{ github.event.inputs.version }}.tgz
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
body: |
Release ${{ github.event.inputs.version }} ✨