-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (39 loc) · 1.33 KB
/
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
name: Create Release
on:
push:
workflow_dispatch:
jobs:
create-release:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Use the latest LTS version of Node.js
# Step 3: Read the version from package.json
- name: Get version from package.json
id: get_version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
# Step 4: Create the tag
- name: Create tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${PACKAGE_VERSION}" -m "Release ${PACKAGE_VERSION}"
git push origin "${PACKAGE_VERSION}"
# Step 5: Create GitHub release
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: "${{ env.PACKAGE_VERSION }}"
release_name: "Release ${{ env.PACKAGE_VERSION }}"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}