-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 2.03 KB
/
release.yml
File metadata and controls
72 lines (61 loc) · 2.03 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write # Need write access to create releases
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
body: |
## 🚀 Usage
```yaml
- uses: tkstang/github-typescript@${{ github.ref_name }}
with:
ts-file: .github/scripts/my-script.ts
node-version: "22"
args: |
{
"key": "value"
}
```
## 📋 Full Changelog
See below for auto-generated release notes.
update-major-tag:
name: Update Major Version Tag
runs-on: ubuntu-latest
needs: create-release
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update major version tag
run: |
# Extract major version from tag (e.g., v1.2.3 -> v1)
TAG_NAME="${GITHUB_REF#refs/tags/}"
MAJOR_VERSION=$(echo "$TAG_NAME" | cut -d. -f1)
echo "Updating $MAJOR_VERSION to point to $TAG_NAME"
# Create or update the major version tag
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Delete existing major tag if it exists
git tag -d "$MAJOR_VERSION" 2>/dev/null || true
git push origin ":refs/tags/$MAJOR_VERSION" 2>/dev/null || true
# Create new major tag pointing to current commit
git tag "$MAJOR_VERSION"
git push origin "$MAJOR_VERSION"