Skip to content

ci: package bumps

ci: package bumps #15

name: Beta Release Pipeline
on:
push:
branches:
- dev
permissions:
contents: write
id-token: write
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Core dependencies
working-directory: packages/core
run: npm ci
- name: Install Express dependencies
working-directory: packages/express
run: npm ci
- name: Test Core
working-directory: packages/core
run: npm test
- name: Test Express
working-directory: packages/express
run: npm test
bump-beta-versions:
name: Bump Beta Versions
runs-on: ubuntu-latest
needs: test
if: "!contains(github.event.head_commit.message, 'chore: bump beta versions')"
outputs:
core_changed: ${{ steps.changes.outputs.core }}
express_changed: ${{ steps.changes.outputs.express }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Detect package changes
id: changes
run: |
CORE=false
EXPRESS=false
if git diff --name-only HEAD~1 HEAD | grep '^packages/core/'; then
CORE=true
fi
if git diff --name-only HEAD~1 HEAD | grep '^packages/express/'; then
EXPRESS=true
fi
echo "core=$CORE" >> $GITHUB_OUTPUT
echo "express=$EXPRESS" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v4
if: steps.changes.outputs.core == 'true' || steps.changes.outputs.express == 'true'
with:
node-version: 20
- name: Bump core beta version
if: steps.changes.outputs.core == 'true'
working-directory: packages/core
run: npm version prerelease --preid=beta --no-git-tag-version
- name: Bump express beta version
if: steps.changes.outputs.express == 'true'
working-directory: packages/express
run: npm version prerelease --preid=beta --no-git-tag-version
- name: Commit version bumps
if: steps.changes.outputs.core == 'true' || steps.changes.outputs.express == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add packages/*/package.json
git commit -m "chore: bump beta versions"
git push origin dev
publish-core-beta:
name: Publish Core Beta
runs-on: ubuntu-latest
needs: bump-beta-versions
if: needs.bump-beta-versions.outputs.core_changed == 'true'
steps:
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install dependencies
working-directory: packages/core
run: npm ci
- name: Build
working-directory: packages/core
run: npm run build
- name: Publish beta
working-directory: packages/core
run: npm publish --tag beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-express-beta:
name: Publish Express Beta
runs-on: ubuntu-latest
needs: bump-beta-versions
if: needs.bump-beta-versions.outputs.express_changed == 'true'
steps:
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install dependencies
working-directory: packages/express
run: npm ci
- name: Build
working-directory: packages/express
run: npm run build
- name: Publish beta
working-directory: packages/express
run: npm publish --tag beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}