-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding app publishing workflow and some minor improvements (#374)
* Starting the refactoring with React 18 and modern JS * Working with pnpm * Adding tsup to build the project * Back to npm and node16 for storybook compatibility * Fixing repo by splitting both lib and app (turbo) * Tweaking projects to function properly * Adding big.js to work with precision float points * Removing React import since it's not needed anymore * Using a more meaningful name and adding types * Adding default value for inputRef * Adding types * Re-issuing the example app * Adding the global start:app task * Moving component to its individual file * Adding react-syntax-highliter and some css * Improving ts configuration * Improving app css * adding lint * adding ci workflow * Removing node 14.x from CI matrix * Adding files and folders to .npmignore * Adding publish workflow * Renaming publish to publish-lib * Building app * Moving to node 18 * Ignoring vercel data * Improving lib publishing worflow * Adding app publishing workflow
- Loading branch information
1 parent
e3e3cef
commit 7aeff7d
Showing
7 changed files
with
108 additions
and
18 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,61 @@ | ||
# This workflow will run tests using node and then publish to vercel when a release is created | ||
name: Publish to Vercel | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm ci | ||
- run: npx turbo run lint | ||
- run: npx turbo run build:app | ||
|
||
- name: Sav app artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: app | ||
path: dist/app | ||
|
||
publish: | ||
|
||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
environment: Production | ||
|
||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
|
||
steps: | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Download previously built app artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: app | ||
|
||
- name: Pull Vercel Environment Information | ||
run: npx vercel@latest pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | ||
|
||
- name: Build Project Artifacts | ||
run: npx vercel@latest build --prod --token=${{ secrets.VERCEL_TOKEN }} | ||
|
||
- name: Deploy Project Artifacts to Vercel | ||
run: npx vercel@latest deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} |
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,34 +1,58 @@ | ||
# This workflow will run tests using node and then publish a package to NPM when a release is created | ||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
name: Publish to NPM | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- run: npm i -g turbo | ||
node-version: 18 | ||
- run: npm ci | ||
- run: turbo run lint | ||
- run: turbo run build:lib | ||
- run: npx turbo run lint | ||
- run: npx turbo run build:lib | ||
|
||
- name: Save lib artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lib | ||
path: dist/lib | ||
|
||
publish-npm: | ||
|
||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
environment: Production | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm i -g turbo | ||
- run: npm ci | ||
- run: turbo run lint | ||
- run: turbo run build:lib | ||
- run: npm publish | ||
|
||
- name: Download previously built lib artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: lib | ||
|
||
- name: Publish npm package | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18 |
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,6 +1,7 @@ | ||
.github/ | ||
.turbo/ | ||
.vscode/ | ||
.vercel/ | ||
dist/app/ | ||
app/ | ||
node_modules/ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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