WIP Release #78
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
name: WIP Release | |
permissions: | |
contents: write | |
packages: write | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'NPM distribution tag (e.g. beta, alpha, next)' | |
required: true | |
default: 'next' | |
branch: | |
description: 'Branch containing the WIP changes (you can specify any branch name)' | |
required: true | |
default: 'main' | |
jobs: | |
wip-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.MOTIA_CI_APP_ID }} | |
private-key: ${{ secrets.MOTIA_CI_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
ref: ${{ github.event.inputs.branch }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Generate version with build number | |
id: version | |
run: | | |
CURRENT_VERSION=$(node -p "require('./packages/snap/package.json').version") | |
echo "Current version: ${CURRENT_VERSION}" | |
NEW_VERSION=$(node -e " | |
const version = require('./packages/snap/package.json').version; | |
const parts = version.split('-'); | |
const baseVersion = parts[0]; | |
if (parts.length > 1 && parts[1].startsWith('beta.')) { | |
const betaNumber = parseInt(parts[1].split('.')[1]); | |
const newBetaNumber = betaNumber + 1; | |
const timestamp = new Date().getTime().toString().slice(-6); | |
console.log(\`\${baseVersion}-beta.\${newBetaNumber}-\${timestamp}\`); | |
} else if (parts.length > 1 && parts[1].startsWith('alpha.')) { | |
const alphaNumber = parseInt(parts[1].split('.')[1]); | |
const newAlphaNumber = alphaNumber + 1; | |
console.log(\`\${baseVersion}-alpha.\${newAlphaNumber}\`); | |
} else { | |
const timestamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14); | |
console.log(\`\${baseVersion}-build.\${timestamp}\`); | |
} | |
") | |
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT | |
echo "Generated version: ${NEW_VERSION}" | |
- name: Set version on all packages | |
run: | | |
pnpm -r --filter "@motiadev/*" exec pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version | |
pnpm -r --filter motia exec pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version | |
- name: Setup NPM authentication | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc | |
- name: Publish packages with custom tag | |
run: | | |
pnpm publish -r --filter @motiadev/core --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/ui --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/workbench --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/stream-client --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/stream-client-browser --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/stream-client-node --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/stream-client-react --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter motia --no-git-checks --tag ${{ github.event.inputs.tag }} | |
pnpm publish -r --filter @motiadev/test --no-git-checks --tag ${{ github.event.inputs.tag }} |