Repository navigation
69 lines (59 loc) · 2.26 KB
/
Copy pathautomated.yml
File metadata and controls
69 lines (59 loc) · 2.26 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
name: Automated Workflow
on:
push:
branches:
- main
jobs:
about:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Sync package.json description and keywords to GitHub repository
env:
GH_TOKEN: ${{ secrets.GITHUB }}
run: |
if [ ! -f package.json ]; then
echo "No package.json found; skipping repository metadata sync."
exit 0
fi
DESCRIPTION=$(jq -r '.description // empty' package.json)
if [ -n "$DESCRIPTION" ]; then
gh api --method PATCH "repos/${GITHUB_REPOSITORY}" -f description="$DESCRIPTION"
else
echo "No package description found; leaving GitHub description unchanged."
fi
if jq -e '.keywords | type == "array"' package.json >/dev/null; then
TOPICS=$(jq -c '.keywords | map(ascii_downcase | gsub("[^a-z0-9-]+"; "-") | gsub("(^-+|-+$)"; "") | .[0:50]) | map(select(length > 0)) | unique | .[0:20]' package.json)
printf '{"names":%s}' "$TOPICS" | gh api --method PUT -H "Accept: application/vnd.github+json" "repos/${GITHUB_REPOSITORY}/topics" --input -
else
echo "No package keywords found; leaving GitHub topics unchanged."
fi
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.GITHUB }} # Authenticates git CLI for tag/commit pushes
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
- name: Install Semantic Release & Plugins
run: |
npm install -g semantic-release \
@semantic-release/changelog \
@semantic-release/npm \
@semantic-release/github \
@semantic-release/git
- name: Run Semantic Release
id: semantic
run: npx semantic-release
env:
GITHUB_TOKEN: "${{ secrets.GITHUB }}"
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
outputs:
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"