forked from atom/github
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Auto 'pretranspile' package on release creation #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+94
−0
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dd5e5e2
Add GHA workflow to pretranspile package on release creation
confused-Techie cfa8a6c
Use top level defined `ELECTRON_VERSION`
confused-Techie 278a901
Update .github/stripAtomTranspilers.js
confused-Techie 3c40099
Clarify branch name, don't push branch to remote
confused-Techie 0698777
Embrace full automation, create duel tags
confused-Techie 7b6ad48
Update .github/workflows/transpile.yml
confused-Techie 8c63065
Update .github/workflows/transpile.yml
confused-Techie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| This small script strips the `atomTranspilers` key from the repos `package.json`. | ||
| Which prevents the editor (Pulsar) from trying to transpile the package at | ||
| startup time, which is unnecessary and redudant on a 'pretranspiled' tag of the | ||
| package. Should save some CPU cycles... and prevent errors if `devDependencies` aren't present. | ||
| */ | ||
|
|
||
| const fs = require("node:fs"); | ||
|
|
||
| const pkgJSON = JSON.parse(fs.readFileSync("./package.json", { encoding: "utf8" })); | ||
|
|
||
| delete pkgJSON.atomTranspilers; | ||
|
|
||
| fs.writeFileSync("./package.json", JSON.stringify(pkgJSON, null, 2) + '\n', { encoding: "utf8" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| name: Auto-Transpile | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
confused-Techie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| inputs: | ||
| releaseType: | ||
| description: "The semver bump type for this release." | ||
| required: true | ||
| default: "patch" | ||
| type: choice | ||
| options: | ||
| - major | ||
| - minor | ||
| - patch | ||
| - premajor | ||
| - preminor | ||
| - prepatch | ||
| - prerelease | ||
|
|
||
| env: | ||
| ELECTRON_VERSION: 30.5.1 | ||
|
|
||
| jobs: | ||
| transpile: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v5 | ||
| - name: Setup NodeJS | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: ${{ vars.NODE_VERSION }} # Use org defined NODE_VERSION | ||
| - name: Install Dependencies | ||
| run: npm install --legacy-peer-deps | ||
| # The legacy-peer-deps flag matches how `pulsar -p install` behaves | ||
| - name: Install NPM Tooling | ||
| run: npm install -g @babel/cli @babel/core | ||
| - name: Log Globally installed NPM tooling | ||
| run: npm ls -g | ||
| - name: Log babel version | ||
| run: npx babel --version | ||
| - name: Setup Git User | ||
| run: | | ||
| git --version | ||
| git config --global user.name "Pulsar-Edit Bot" | ||
| git config --global user.email "<no-reply@users-github.com>" | ||
| - name: Disable NPM Git tag creation on version bump | ||
| run: npm config set git-tag-version false | ||
| - name: Bump Version | ||
| run: npm version ${{ inputs.releaseType }} | ||
| - name: Find Current Version | ||
| run: | | ||
| NODE_PKG_VERSION=$(node -p "require('./package.json').version") | ||
| echo "NODE_PKG_VERSION=$NODE_PKG_VERSION" >> $GITHUB_ENV | ||
| - name: Commit changes | ||
| run: | | ||
| git add | ||
| git commit -m "Bump Version to v${{ env.NODE_PKG_VERSION }}" | ||
| - name: Tag changes as base tag | ||
| run: git tag v${{ env.NODE_PKG_VERSION }} | ||
confused-Techie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Push updated default branch to remote | ||
| run: git push | ||
| - name: Push base tag to remote | ||
| run: git push origin v${{ env.NODE_PKG_VERSION }} | ||
| - name: Create new pretranspiled branch | ||
| run: git switch -c v${{ env.NODE_PKG_VERSION }}-pretranspiled-working-branch | ||
| - name: Transpile Source | ||
| run: ELECTRON_VERSION=${{ env.ELECTRON_VERSION }} babel lib -d lib --compact auto --source-type module | ||
| - name: Strip `atomTranspilers` from `package.json` | ||
| run: node ./.github/stripAtomTranspilers.js | ||
| - name: Commit changes | ||
| run: | | ||
| git add | ||
| git commit -m "Pretranspile package" | ||
| - name: Tag changes | ||
| run: git tag v${{ env.NODE_PKG_VERSION }}-pretranspiled | ||
| - name: Push tag to remote | ||
| run: git push origin v${{ env.NODE_PKG_VERSION }}-pretranspiled | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.