-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (69 loc) · 2.43 KB
/
Copy pathsync.yml
File metadata and controls
72 lines (69 loc) · 2.43 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: Sync Version CI/CD (Mowojang)
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: write
id-token: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get latest Mowojang Version
id: latest
run: |
VERSION=$(curl -fsSL https://registry.npmjs.org/mowojang/latest | jq -r '.version')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Get current Mowojang Version
id: current
run: |
VERSION=$(jq -r '.version' package.json)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Check if Mowojang Versions are inequal
id: check
run: |
if [ "${{ steps.latest.outputs.version }}" = "${{ steps.current.outputs.version }}" ]; then
echo "needed=false" >> "$GITHUB_OUTPUT"
else
echo "needed=true" >> "$GITHUB_OUTPUT"
fi
- uses: pnpm/action-setup@v6
if: steps.check.outputs.needed == 'true'
with:
version: 11
run_install: true
- uses: actions/setup-node@v6
if: steps.check.outputs.needed == 'true'
with:
node-version: "26"
cache: "pnpm"
- name: Update package.json
if: steps.check.outputs.needed == 'true'
run: |
NEW="${{ steps.latest.outputs.version }}"
jq --arg v "$NEW" '.version = $v | .dependencies.mowojang = $v' package.json > package.json.tmp
mv package.json.tmp package.json
- name: Install dependencies
if: steps.check.outputs.needed == 'true'
run: pnpm install --no-frozen-lockfile
- name: Commit Bump
if: steps.check.outputs.needed == 'true'
run: |
NEW="${{ steps.latest.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add package.json pnpm-lock.yaml pnpm-workspace.yaml
git commit -m "Bumped Mowojang to v${NEW}"
git push
- name: Create Release
if: steps.check.outputs.needed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW="${{ steps.latest.outputs.version }}"
gh release create "v${NEW}" --title "v${NEW}" --generate-notes
- name: Publish Package
if: true
run: pnpm publish --no-git-checks --provenance