-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stabilish canary releases, fix broken installers (#26)
- Loading branch information
Showing
8 changed files
with
107 additions
and
66 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-cardinal-app": patch | ||
--- | ||
|
||
(cli): rewrite scaffolding logic for broken installers |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fs from 'fs'; | ||
import { exec } from 'child_process'; | ||
|
||
const pkgJsonPaths = [ | ||
"cli/package.json" | ||
] | ||
|
||
try { | ||
exec("git rev-parse --short HEAD", (err, stdout) => { | ||
if (err) { | ||
console.log(err); | ||
process.exit(1); | ||
} | ||
const commitHash = stdout.trim(); | ||
|
||
for (const pkgJsonPath of pkgJsonPaths) { | ||
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8")); | ||
const oldVersion = pkg.version; | ||
const [major, minor, patch] = oldVersion.split(".").map(Number); | ||
const newVersion = `${major}.${minor}.${patch + 1}-canary.${commitHash}`; | ||
pkg.version = newVersion; | ||
const content = JSON.stringify(pkg, null, "\t") + "\n"; | ||
|
||
fs.writeFileSync(pkgJsonPath, content); | ||
} | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,9 @@ on: | |
branches: | ||
- canary | ||
|
||
permissions: | ||
id-token: write | ||
|
||
jobs: | ||
release-canary: | ||
if: ${{ github.repository_owner == 'ernesto-oss' }} | ||
|
@@ -45,31 +48,19 @@ jobs: | |
- name: Build | ||
run: pnpm turbo --filter=create-cardinal-app build | ||
|
||
- name: Create Version PR or Publish Canary to NPM | ||
id: changeset | ||
uses: changesets/action@v1 | ||
with: | ||
commit: "chore(release-canary): version packages" | ||
title: "chore(release-canary): version packages" | ||
version: "npx changeset version --snapshot canary" | ||
publish: "npx changeset publish --no-git-tag --tag canary" | ||
## The change made to package.json here is ephemeral, as it will only run in CI | ||
- name: Bump version to canary | ||
run: node .github/canary-release.js | ||
|
||
- name: Install NPM | ||
run: npm i -g [email protected] # need latest version for provenance | ||
|
||
- name: Authenticate to npm and publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NODE_ENV: "production" | ||
|
||
- name: Get ID of latest Github release | ||
id: releaseId | ||
if: steps.changeset.outputs.published == 'true' | ||
run: | | ||
releaseId="$(gh release view --json id -R ernesto-oss/cardinal --jq '.id')" | ||
echo 'RELEASE_ID='$releaseId >> "$GITHUB_OUTPUT" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Edit latest release to pre-release | ||
if: steps.changeset.outputs.published == 'true' | ||
uses: irongut/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
id: ${{ steps.releaseId.outputs.releaseId }} | ||
pnpm build:cli | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | ||
cd ./cli | ||
npm publish --provenance --access public --ignore-scripts --tag canary | ||
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,5 +1,3 @@ | ||
# create-cardinal-app | ||
|
||
## 0.2.1 | ||
|
||
### Patch Changes | ||
|
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
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
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
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