Skip to content

Commit d497dcd

Browse files
committed
github build steps
1 parent 1d6901b commit d497dcd

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: jogibear9988
4+
patreon: jogibear9988
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build and Publish on Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20'
18+
registry-url: 'https://registry.npmjs.org/'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Build package
24+
run: |
25+
if [ -f package.json ]; then
26+
npm run build || echo "No build script, skipping build."
27+
fi
28+
29+
- name: Publish to npm
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
run: npm publish --access public
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Update Monaco Editor
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
update-monaco:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
fetch-depth: 0
19+
20+
- name: Set up Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
cache: npm
25+
26+
- name: Update Monaco Editor
27+
run: npm install --save-dev monaco-editor@latest
28+
29+
- name: Resolve Monaco Editor version
30+
id: monaco
31+
shell: bash
32+
run: |
33+
VERSION=$(node -p "require('./node_modules/monaco-editor/package.json').version")
34+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
35+
36+
- name: Set package version
37+
run: npm version "${{ steps.monaco.outputs.version }}" --no-git-tag-version --allow-same-version
38+
39+
- name: Refresh install and lockfile
40+
run: npm install
41+
42+
- name: Build package
43+
run: npm run build
44+
45+
- name: Detect repository changes
46+
id: changes
47+
shell: bash
48+
run: |
49+
if [[ -n "$(git status --porcelain -- package.json package-lock.json esm min)" ]]; then
50+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
51+
else
52+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
53+
fi
54+
55+
- name: Commit, tag, and push changes
56+
if: steps.changes.outputs.has_changes == 'true'
57+
shell: bash
58+
run: |
59+
git config user.name "github-actions[bot]"
60+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
61+
git add package.json package-lock.json esm min
62+
git commit -m "chore: update monaco-editor to v${{ steps.monaco.outputs.version }}"
63+
git tag "${{ steps.monaco.outputs.version }}"
64+
git push origin "HEAD:${{ github.ref_name }}"
65+
git push origin "${{ steps.monaco.outputs.version }}"
66+
67+
- name: Create GitHub release
68+
if: steps.changes.outputs.has_changes == 'true'
69+
uses: softprops/action-gh-release@v2
70+
with:
71+
tag_name: ${{ steps.monaco.outputs.version }}
72+
name: ${{ steps.monaco.outputs.version }}
73+
body: |
74+
Automated release for Monaco Editor ${{ steps.monaco.outputs.version }}.
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)