Skip to content

Commit

Permalink
chore(ci): add publish workflow (#3)
Browse files Browse the repository at this point in the history
* fix(ci): correct build order

* chore: update publish scripts

* chore: update workflow

* chore: fixes

* chore: apply versions and publish

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
thezzisu and github-actions authored Dec 18, 2023
1 parent b3fc803 commit 1fb9092
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:
contents: write

jobs:
check:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -19,7 +19,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -37,9 +36,10 @@ jobs:
run: corepack yarn

- name: Build packages
run: corepack yarn workspaces foreach -t run build
run: corepack yarn workspaces foreach --topological-dev run build

- name: Setup Yarn
run: corepack yarn config set -H 'npmAuthToken' "${{ secrets.NPM_TOKEN }}"

- name: Publish and commit
run: corepack yarn zx scripts/publish.mjs
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aoi-js/frontend",
"version": "0.0.37",
"version": "0.0.38",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"all:check-lint": "yarn workspaces foreach run lint",
"all:check-format": "yarn workspaces foreach run format",
"all:check-type": "yarn workspaces foreach run type-check",
"all:check": "concurrently -m 1 \"yarn:all:check-*\"",
"all:check": "concurrently \"yarn:all:check-*\"",
"git:precommit": "run all:check"
},
"dependencies": {
Expand Down
18 changes: 10 additions & 8 deletions scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ for (const { ident } of items) {
shouldCommit = true
}

if (shouldCommit && process.env.CI) {
await $`git config user.name github-actions`
await $`git config user.email [email protected]`
await $`git add .`
await $`git commit -m "chore: apply versions and publish"`
await $`git push`
} else {
console.log(`Time to commit and push!`)
if (shouldCommit) {
if (process.env.CI) {
await $`git config user.name github-actions`
await $`git config user.email [email protected]`
await $`git add .`
await $`git commit -m "chore: apply versions and publish"`
await $`git push`
} else {
console.log(`Time to commit and push!`)
}
}

0 comments on commit 1fb9092

Please sign in to comment.