-
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.
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
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,8 @@ | ||
name: "Determine version" | ||
description: "Determines npm package version based on PR number and commit SHA" | ||
outputs: | ||
version: | ||
description: "npm package version" | ||
runs: | ||
using: "node20" | ||
main: "index.js" |
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,20 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const core = require('@actions/core') | ||
|
||
try { | ||
const packageJSONPath = path.join( | ||
process.cwd(), | ||
`packages/${process.env.PACKAGE_PATH || 'react'}/package.json`, | ||
) | ||
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf8')) | ||
|
||
const sha8 = process.env.GITHUB_SHA.substring(0, 8) | ||
const prefix = '0.0.0-' | ||
const packageVersion = `${prefix}manual.${sha8}` | ||
packageJSON.version = packageVersion | ||
core.setOutput('version', packageVersion) | ||
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON)) | ||
} catch (error) { | ||
core.setFailed(error.message) | ||
} |
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,60 @@ | ||
name: Manual Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- mainline | ||
pull_request: | ||
# TODO: Support latest releases | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
type: choice | ||
description: Package name (npm) | ||
options: | ||
- "@abstract-money/core" | ||
- "@abstract-money/cli" | ||
- "@abstract-money/react" | ||
# TODO: Infer from package name | ||
path: | ||
type: choice | ||
description: Directory name (packages/*) | ||
options: | ||
- "core" | ||
- "cli" | ||
- "react" | ||
env: | ||
FORCE_COLOR: true | ||
|
||
jobs: | ||
release-manual: | ||
name: Publish manually | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
|
||
- name: Determine version | ||
uses: ./.github/actions/version-pr | ||
id: determine-version | ||
env: | ||
PACKAGE_PATH: ${{ github.event.inputs.path }} | ||
- name: Publish to npm | ||
run: | | ||
pnpm build | ||
cd packages/$PACKAGE_PATH | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | ||
pnpm publish --no-git-checks --access public --tag experimental | ||
echo "🎉 Experimental release published 📦️ on npm: https://npmjs.com/package/${{ github.event.inputs.name }}/v/${{ env.VERSION }}" | ||
echo "Install via: pnpm add ${{ github.event.inputs.name }}@${{ env.VERSION }}" | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
PACKAGE_PATH: ${{ github.event.inputs.path }} | ||
VERSION: ${{ steps.determine-version.outputs.version }} |
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