feat: clean up CI/CD piplelines

This commit is contained in:
SethBurkart123
2024-11-15 17:24:26 +11:00
parent 0e23ea0cc3
commit 96cf8e3eac
2 changed files with 27 additions and 100 deletions
+27 -62
View File
@@ -1,73 +1,38 @@
name: MVP - make, version & publish name: NodeJS Build
on: on:
push: push:
branches: branches: [ "main" ]
- main pull_request:
workflow_dispatch: # This line adds manual triggering from the GitHub UI branches: [ "main" ]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
make_version_publish: build:
name: Make, Version & Publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps: steps:
- name: Checkout Repo - uses: actions/checkout@v4
uses: actions/checkout@v4
- name: Setup Node 20.x - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20.x node-version: ${{ matrix.node-version }}
- name: Install bun & Deps - name: Build
run: npm install bun -g run: |
npm install
npm run build
- name: 'Build - all browsers' - name: Zip dist folder
id: buildProject run: |
run: | zip -r dist.zip dist
bun install
bun run build
- name: '[ V E R S I O N ] : Create or Update Release Pull Request - Version Changes' - name: Upload artifact
id: changesets uses: actions/upload-artifact@v4
uses: changesets/action@v1 with:
with: name: dist-zip
version: bun run version path: dist.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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 }}
-38
View File
@@ -1,38 +0,0 @@
name: NodeJS Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
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