Skip to content

Commit

Permalink
chore: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Nov 4, 2024
1 parent 53b7d71 commit 743d80a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ on:

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

- uses: asdf-vm/actions/install@v2
- uses: asdf-vm/actions/install@v3

- run: deno task build

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16

- uses: cycjimmy/semantic-release-action@v3
- uses: cycjimmy/semantic-release-action@v4
with:
working_directory: npm
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ on:
paths:
- "*.ts"
push:
tags-ignore:
- "**"
branches:
- "develop"
paths:
- "*.ts"
workflow_dispatch:

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

- uses: asdf-vm/actions/install@v2
- uses: asdf-vm/actions/install@v3

- run: deno task build
73 changes: 73 additions & 0 deletions .github/workflows/update-changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: update-changesets

env:
WORKFLOW_FILE: update-changesets.yml
CHANGESETS_FILE: changesets
RSS_URLS: |
https://unity.com/releases/editor/lts-releases.xml
https://unity.com/releases/editor/tech-and-preview-releases.xml
https://unity.com/releases/editor/beta-releases.xml
https://unity.com/releases/editor/alpha-releases.xml
REGEX_UNITY_VERSION: '[0-9]{4,}\.[0-9]{1,}\.[0-9]{1,}(a|b|f|rc|p)[0-9]{1,}'

on:
issue_comment:
types:
- created

jobs:
build:
if: startsWith(github.event.comment.body, '/update-changesets') && github.event.issue.locked
name: 🛠️ Update changesets
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- name: 🚚 Checkout (gh_pages)
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: gh_pages
- name: 🔍 Check other workflows
run: |
# Get in-progress or queued workflows.
gh auth login --with-token < <(echo ${{ github.token }})
RESULT=`gh run list --workflow ${{ env.WORKFLOW_FILE }} --json status --jq '[.[] | select(.status == "in_progress")] | length == 1'`
# [ERROR] Other workflows are in progress.
[ "$RESULT" = "false" ] && echo "::error::Other '${{ env.WORKFLOW_FILE }}' workflows are in progress." && exit 1 || :
- name: 🛠️ Update changesets file
run: |
touch "${{ env.CHANGESETS_FILE }}"
urls=(`echo "${{ env.RSS_URLS }}"`)
for url in "${urls[@]}"; do
# Find versions from RSS
echo "Processing: $url" | tee -a $GITHUB_STEP_SUMMARY
versions=($(curl -s "$url" | grep -oE "${{ env.REGEX_UNITY_VERSION }}" | sort -u))
for version in "${versions[@]}"; do
# Already exists
if grep -q "$version" "${{ env.CHANGESETS_FILE }}"; then
continue
fi
# Get changeset for the Unity version
changeset_output=$(npx unity-changeset "$version" 2>/dev/null)
if [ $? -eq 0 ]; then
echo -e "$version\t$changeset_output" | tee -a "${{ env.CHANGESETS_FILE }}" $GITHUB_STEP_SUMMARY
else
echo " Error: $version is not valid"
fi
done
done
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ github.token }}
amend: true
force: true
branch: gh_pages

0 comments on commit 743d80a

Please sign in to comment.