Skip to content

Commit

Permalink
chore(ci): update scripts (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
thezzisu authored Mar 25, 2024
1 parent b1d843b commit 3c754d7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ jobs:
token: ${{ steps.app-token.outputs.token }}

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down Expand Up @@ -80,14 +81,14 @@ jobs:
run: node -p -e "'version='+require('./apps/server/package.json').version" >> $GITHUB_OUTPUT

- name: Log in to Aliyun Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ACR_USER }}
password: ${{ secrets.ACR_PASS }}

- name: Build and push server Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: true
context: '.'
Expand Down
3 changes: 3 additions & 0 deletions .yarn/versions/743c80d6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
releases:
"@aoi-js/frontend": 1.1.0-alpha.2
"@aoi-js/server": 1.1.0-alpha.2
11 changes: 10 additions & 1 deletion scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ const items = stdout
for (const { ident } of items) {
console.log(`Publishing ${chalk.greenBright(ident)}...`)
await $`yarn workspace ${ident} pack --out package.tgz`
await $`cd ${packages[ident]} && npm publish package.tgz --provenance`.nothrow()
try {
await $`cd ${packages[ident]} && npm publish package.tgz --provenance`
} catch (err) {
const stdout = /** @type {ProcessOutput} */ (err).stdout
if (stdout.includes('You cannot publish over the previously published versions')) {
console.log(`${ident} already published, skip it.`)
} else {
throw err
}
}
if (process.env.CI) {
const name = ident.split('/')[1]
await $`echo "${name}_updated=true" >> "$GITHUB_OUTPUT"`
Expand Down

0 comments on commit 3c754d7

Please sign in to comment.