Skip to content

Commit

Permalink
Move next version into environment variable for Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhobbs committed Oct 7, 2024
1 parent 123506f commit fd56fdb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,17 @@ jobs:
- run: corepack enable
- name: Install dependencies
run: yarn install --immutable

- name: Get Next Version
id: next_version
run: |
export NEXT_VERSION="$(node ./scripts/getNextVersion.mjs)"
echo "Next Version: $NEXT_VERSION"
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
- name: Create Release
run: yarn run release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
NEXT_VERSION: ${{ steps.next_version.outputs.version }}
SENTRY_RELEASE: ${{ steps.next_version.outputs.version }}
17 changes: 17 additions & 0 deletions scripts/getNextVersion.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node

import { $ } from 'execa';

async function main() {
const { stdout: status } = await $`git status --porcelain`;
if (status) {
console.error(`❗️ Working directory is not clean:\n${status}`);
return;
}

const { stdout: nextVersion } = await $`auto shipit --dry-run --quiet`;

console.log(nextVersion);
}

main();
6 changes: 5 additions & 1 deletion scripts/versionAndBuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ async function main() {
return;
}

const { stdout: nextVersion } = await $`auto shipit --dry-run --quiet`;
const nextVersion = process.env.NEXT_VERSION;
if (nextVersion === undefined) {
console.error('❗️ NEXT_VERSION environment variable is required');
return;
}

console.info(`📌 Temporarily bumping version to '${nextVersion}' for build step`);
await $`npm --no-git-tag-version version ${nextVersion}`;
Expand Down

0 comments on commit fd56fdb

Please sign in to comment.