-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e23ea0
commit 96cf8e3
Showing
2 changed files
with
30 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,73 +1,38 @@ | ||
name: MVP - make, version & publish | ||
name: NodeJS Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: # This line adds manual triggering from the GitHub UI | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
make_version_publish: | ||
name: Make, Version & Publish | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Install bun & Deps | ||
run: npm install bun -g | ||
|
||
- name: 'Build - all browsers' | ||
id: buildProject | ||
run: | | ||
bun install | ||
bun run build | ||
|
||
- name: '[ V E R S I O N ] : Create or Update Release Pull Request - Version Changes' | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
version: bun run version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
- name: 'Get current version info from package.json' | ||
if: steps.changesets.outputs.hasChangesets == 'false' | ||
id: package | ||
run: | | ||
echo "::set-output name=PACKAGE_NAME::$(jq -r .name package.json)" | ||
echo "::set-output name=PACKAGE_VERSION::$(jq -r .version package.json)" | ||
working-directory: ${{ github.workspace }} | ||
|
||
- name: 'Check if a git release already exists for current version' | ||
if: steps.changesets.outputs.hasChangesets == 'false' | ||
id: checkRelease | ||
run: | | ||
TAG_NAME=${{ steps.package.outputs.PACKAGE_NAME }}@${{ steps.package.outputs.PACKAGE_VERSION }} | ||
if gh release view $TAG_NAME &>/dev/null; then | ||
echo "Release $TAG_NAME already exists." | ||
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV | ||
else | ||
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV | ||
fi | ||
- name: 'Create Release Archive(s) - zip 🫰 it 🫰 up 🫰 !' | ||
id: zip | ||
if: steps.changesets.outputs.hasChangesets == 'false' | ||
run: bun run zip | ||
|
||
- name: 'Create a git release w/ notes & release archive(s)' | ||
id: gitRelease | ||
if: steps.changesets.outputs.hasChangesets == 'false' && env.RELEASE_EXISTS != 'true' | ||
run: bun run release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PACKAGE_NAME: ${{ steps.package.outputs.PACKAGE_NAME }} | ||
PACKAGE_VERSION: ${{ steps.package.outputs.PACKAGE_VERSION }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Zip dist folder | ||
run: | | ||
zip -r dist.zip dist | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-zip | ||
path: dist.zip |
This file was deleted.
Oops, something went wrong.