|
| 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