Skip to content

Commit 743d80a

Browse files
committed
chore: update workflows
1 parent 53b7d71 commit 743d80a

File tree

3 files changed

+84
-11
lines changed

3 files changed

+84
-11
lines changed

.github/workflows/release.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ on:
1010

1111
jobs:
1212
release:
13-
if: "! contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.head_commit.message, '[ci skip]')"
13+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]') }}
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

18-
- uses: asdf-vm/actions/install@v2
18+
- uses: asdf-vm/actions/install@v3
1919

2020
- run: deno task build
2121

22-
- uses: actions/setup-node@v3
22+
- uses: actions/setup-node@v4
2323
with:
2424
node-version: 16
2525

26-
- uses: cycjimmy/semantic-release-action@v3
26+
- uses: cycjimmy/semantic-release-action@v4
2727
with:
2828
working_directory: npm
2929
env:
30-
GITHUB_TOKEN: ${{ github.token }}
30+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3131
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3232

.github/workflows/test.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ on:
55
paths:
66
- "*.ts"
77
push:
8-
tags-ignore:
9-
- "**"
8+
branches:
9+
- "develop"
1010
paths:
1111
- "*.ts"
1212
workflow_dispatch:
1313

1414
jobs:
1515
test:
16-
if: "! contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.head_commit.message, '[ci skip]')"
16+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]') }}
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020

21-
- uses: asdf-vm/actions/install@v2
21+
- uses: asdf-vm/actions/install@v3
2222

2323
- run: deno task build
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: update-changesets
2+
3+
env:
4+
WORKFLOW_FILE: update-changesets.yml
5+
CHANGESETS_FILE: changesets
6+
RSS_URLS: |
7+
https://unity.com/releases/editor/lts-releases.xml
8+
https://unity.com/releases/editor/tech-and-preview-releases.xml
9+
https://unity.com/releases/editor/beta-releases.xml
10+
https://unity.com/releases/editor/alpha-releases.xml
11+
REGEX_UNITY_VERSION: '[0-9]{4,}\.[0-9]{1,}\.[0-9]{1,}(a|b|f|rc|p)[0-9]{1,}'
12+
13+
on:
14+
issue_comment:
15+
types:
16+
- created
17+
18+
jobs:
19+
build:
20+
if: startsWith(github.event.comment.body, '/update-changesets') && github.event.issue.locked
21+
name: 🛠️ Update changesets
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
actions: read
26+
steps:
27+
- name: 🚚 Checkout (gh_pages)
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
ref: gh_pages
32+
- name: 🔍 Check other workflows
33+
run: |
34+
# Get in-progress or queued workflows.
35+
gh auth login --with-token < <(echo ${{ github.token }})
36+
RESULT=`gh run list --workflow ${{ env.WORKFLOW_FILE }} --json status --jq '[.[] | select(.status == "in_progress")] | length == 1'`
37+
38+
# [ERROR] Other workflows are in progress.
39+
[ "$RESULT" = "false" ] && echo "::error::Other '${{ env.WORKFLOW_FILE }}' workflows are in progress." && exit 1 || :
40+
41+
- name: 🛠️ Update changesets file
42+
run: |
43+
touch "${{ env.CHANGESETS_FILE }}"
44+
urls=(`echo "${{ env.RSS_URLS }}"`)
45+
for url in "${urls[@]}"; do
46+
# Find versions from RSS
47+
echo "Processing: $url" | tee -a $GITHUB_STEP_SUMMARY
48+
versions=($(curl -s "$url" | grep -oE "${{ env.REGEX_UNITY_VERSION }}" | sort -u))
49+
50+
for version in "${versions[@]}"; do
51+
# Already exists
52+
if grep -q "$version" "${{ env.CHANGESETS_FILE }}"; then
53+
continue
54+
fi
55+
56+
# Get changeset for the Unity version
57+
changeset_output=$(npx unity-changeset "$version" 2>/dev/null)
58+
59+
if [ $? -eq 0 ]; then
60+
echo -e "$version\t$changeset_output" | tee -a "${{ env.CHANGESETS_FILE }}" $GITHUB_STEP_SUMMARY
61+
else
62+
echo " Error: $version is not valid"
63+
fi
64+
done
65+
done
66+
67+
- name: Commit & Push changes
68+
uses: actions-js/push@master
69+
with:
70+
github_token: ${{ github.token }}
71+
amend: true
72+
force: true
73+
branch: gh_pages

0 commit comments

Comments
 (0)