Skip to content

Commit

Permalink
ci: prepare publish
Browse files Browse the repository at this point in the history
  • Loading branch information
robby rabbitman committed Jun 29, 2024
1 parent 9d8129c commit 9a3b743
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
name: CI
name: ci

on:
push:
branches:
- main
pull_request:

permissions:
actions: read
contents: read

jobs:
main:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- run: corepack enable

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: 'pnpm'
Expand All @@ -30,10 +29,15 @@ jobs:

- run: pnpm i

- run: pnpm exec nx report

- if: github.event_name == 'push'
run: pnpm exec nx run tools-commitlint:exec:last

- if: github.event_name == 'pull_request'
run: nx run tools-commitlint:exec:last --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }}

- run: pnpm exec nx affected -t lint test build

- if: github.event_name == 'push'
run: nx release --skip-publish
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: publish

on:
push:
tags:
- '*'

jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- uses: nrwl/nx-set-shas@v4

- run: pnpm i

- run: pnpm exec nx report

- run: npx nx release publish --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
15 changes: 13 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
}
},
"changelog": {
"automaticFromRef": true
"automaticFromRef": true,
"workspaceChangelog": {
"renderOptions": {
"authors": false
}
}
},
"projects": ["packages/*"]
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": []
"sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
},
"plugins": [
{
Expand All @@ -35,6 +40,12 @@
}
],
"targetDefaults": {
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
},
"dependsOn": ["build"]
},
"@nx/js:tsc": {
"cache": true,
"dependsOn": ["^build"],
Expand Down

0 comments on commit 9a3b743

Please sign in to comment.