Skip to content

Commit ae73539

Browse files
committed
ci: Change ci action
1 parent 0203a80 commit ae73539

File tree

4 files changed

+140
-0
lines changed

4 files changed

+140
-0
lines changed

.github/actions/action.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'My composite action'
2+
description: 'Checks out the repository and install'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- uses: actions/checkout@v4
7+
with:
8+
fetch-depth: 0
9+
- name: Setup Node.js
10+
uses: actions/setup-node@v4
11+
with:
12+
node-version: 20
13+
- name: Restore cached npm dependencies
14+
id: cache-dependencies-restore
15+
uses: actions/cache/restore@v4
16+
with:
17+
path: |
18+
node_modules
19+
~/.cache/Cypress # needed for the Cypress binary
20+
key: ${{ runner.os }}npm-dependencies-${{ hashFiles('package-lock.json') }}
21+
- name: Npm install
22+
run: npm ci
23+
shell: bash
24+
- name: Cache npm dependencies
25+
id: cache-dependencies-save
26+
uses: actions/cache/save@v4
27+
with:
28+
path: |
29+
node_modules
30+
~/.cache/Cypress # needed for the Cypress binary
31+
key: ${{ steps.cache-dependencies-restore.outputs.cache-primary-key }}
32+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
33+
uses: nrwl/nx-set-shas@v4
34+
with:
35+
main-branch-name: "master"

.github/workflows/bump-version.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Create Releases
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build-and-test:
7+
name: "Build and test"
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: "read"
11+
actions: "read"
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Npm install
17+
uses: ./.github/actions
18+
- run: npx nx affected -t lint test build --parallel=3 --exclude='test-npm' --base=origin/main~1 --head=origin/main
19+
# - run: npm nx affected -t e2e-ci --parallel=1
20+
# - run: npm nx affected -t deploy --no-agents
21+
22+
bump-version:
23+
name: "Bump version"
24+
needs:
25+
- build-and-test
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: "write"
29+
actions: "read"
30+
id-token: "write"
31+
timeout-minutes: 10
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
- name: Checkout and install
42+
uses: ./.github/actions
43+
- name: Bump version
44+
run: |
45+
git config user.name 'Alex H'
46+
git config user.email '[email protected]'
47+
npx nx release --skip-publish
48+
shell: bash
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
NPM_CONFIG_PROVENANCE: true

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
types:
7+
- opened
8+
- synchronize
9+
jobs:
10+
run-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Npm install
17+
uses: ./.github/actions
18+
# This line is needed for nx affected to work when CI is running on a PR
19+
- run: git branch --track main origin/main
20+
- run: npx nx affected -t lint test build --parallel=3 --exclude='test-npm'
21+
# - run: npm nx affected -t e2e-ci --parallel=1
22+
# - run: npm nx affected -t deploy --no-agents

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Create Releases" ]
6+
types:
7+
- completed
8+
env:
9+
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
10+
NPM_CONFIG_PROVENANCE: true
11+
12+
jobs:
13+
publish:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
name: Publish
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: "read"
19+
actions: "read"
20+
id-token: "write" # needed for provenance data generation
21+
timeout-minutes: 10
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Npm install
27+
uses: ./.github/actions
28+
- run: npx nx affected -t build --parallel=3 --exclude='test-npm' --base=origin/main~1 --head=origin/main
29+
- name: Publish packages
30+
run: npx nx release publish
31+
shell: bash

0 commit comments

Comments
 (0)