Skip to content

Commit

Permalink
chore: configure ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho-vazquez committed Jul 7, 2024
1 parent d765190 commit 034f2c9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 39 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
name: Release

on:
- workflow_dispatch
push:
tags:
- v*.*.*
workflow_run:


jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # needed for provenance data generation

if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
with:
Expand All @@ -21,20 +28,9 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_CONFIG_PROVENANCE: true
# Use npx instead of yarn because yarn automagically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
shell: bash
run: npx nx affected --base=last-release --target=version

- name: Tag last-release
shell: bash
run: git tag -f last-release

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}
force: true
tags: true
run: npx nx release publish
5 changes: 4 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@
"projects": ["nx-cloudflare"],
"projectsRelationship": "independent",
"version": {
"conventionalCommits": true
"conventionalCommits": true,
"generatorOptions": {
"updateDependents": true
}
},
"git": {
"commit": true,
Expand Down
17 changes: 0 additions & 17 deletions packages/nx-cloudflare/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,6 @@
}
]
}
},
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "${tag}",
"notes": "${notes}"
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
}
},
"publish": {
"command": "node tools/scripts/publish.mjs nx-cloudflare {args.ver} {args.tag}",
"dependsOn": ["build"]
}
}
}
22 changes: 16 additions & 6 deletions tools/scripts/start-local-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry';
import { execFileSync } from 'child_process';
import { releasePublish, releaseVersion } from 'nx/release';

export default async () => {
// local registry target to run
Expand All @@ -16,10 +17,19 @@ export default async () => {
storage,
verbose: false,
});
const nx = require.resolve('nx');
execFileSync(
nx,
['run-many', '--targets', 'publish', '--ver', '0.0.0-e2e', '--tag', 'e2e'],
{ env: process.env, stdio: 'inherit' }
);

await releaseVersion({
specifier: '0.0.0-e2e',
stageChanges: false,
gitCommit: false,
gitTag: false,
firstRelease: true,
generatorOptionsOverrides: {
skipLockFileUpdate: true,
},
});
await releasePublish({
tag: 'e2e',
firstRelease: true,
});
};

0 comments on commit 034f2c9

Please sign in to comment.