Skip to content

Commit 744c851

Browse files
authored
Merge pull request #427 from ForgeRock/fix-publish-packages-slack
chore: fix-slackbot
2 parents ba94c26 + 0460874 commit 744c851

File tree

11 files changed

+359
-463
lines changed

11 files changed

+359
-463
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Publish Beta Steps'
2+
description: 'Steps to run when packages are not published (beta branch)'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Create PR for beta publish
8+
shell: bash
9+
run: pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm --comment=off
10+
11+
- name: Run Builds
12+
shell: bash
13+
run: pnpm nx run-many -t build --no-agents
14+
15+
- name: Generate API Docs
16+
shell: bash
17+
run: pnpm generate-docs
18+
19+
- name: Publish api docs [beta]
20+
uses: JamesIves/[email protected]
21+
with:
22+
folder: docs
23+
commit-message: 'chore: release-api-docs-beta'
24+
target-folder: 'beta'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Publish Release Steps'
2+
description: 'Steps to run when packages are published'
3+
inputs:
4+
publishedPackages:
5+
description: 'Published packages JSON'
6+
required: true
7+
slackWebhook:
8+
description: 'Slack webhook URL'
9+
required: true
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Format publishedPackages for Slack
14+
id: slackify
15+
shell: bash
16+
run: |
17+
raw='${{ inputs.publishedPackages }}'
18+
message=$(echo "$raw" | jq -r '.[] | "- \(.name) v\(.version)"')
19+
echo "message<<EOF" >> $GITHUB_OUTPUT
20+
echo "$message" >> $GITHUB_OUTPUT
21+
echo "EOF" >> $GITHUB_OUTPUT
22+
23+
- name: Send to Slack Workflow
24+
uses: slackapi/[email protected]
25+
with:
26+
webhook: ${{ inputs.slackWebhook }}
27+
webhook-type: webhook-trigger
28+
payload: >
29+
{
30+
"publishedPackages": "${{ steps.slackify.outputs.message }}"
31+
}
32+
33+
- name: Run Builds
34+
shell: bash
35+
run: pnpm nx run-many -t build --no-agents
36+
37+
- name: Generate API Docs
38+
shell: bash
39+
run: pnpm generate-docs
40+
41+
- name: Publish api docs
42+
uses: JamesIves/[email protected]
43+
with:
44+
folder: docs
45+
commit-message: 'chore: release-api-docs'

.github/actions/setup/action.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: 'Setup Project'
2+
description: 'Centralized setup for CI jobs'
3+
inputs:
4+
node-version-file:
5+
description: 'Node version file'
6+
required: false
7+
default: '.node-version'
8+
pnpm-cache-folder:
9+
description: 'pnpm cache folder'
10+
required: false
11+
default: '.pnpm-store'
12+
CODECOV_TOKEN:
13+
description: 'CODECOV_TOKEN'
14+
required: true
15+
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- uses: pnpm/action-setup@v4
20+
with:
21+
run_install: false
22+
23+
- name: Setup pnpm config
24+
run: pnpm config set store-dir ${{ inputs.pnpm-cache-folder }} --global
25+
shell: bash
26+
27+
- uses: actions/setup-node@v6
28+
with:
29+
node-version-file: ${{ inputs.node-version-file }}
30+
cache: 'pnpm'
31+
registry-url: 'https://registry.npmjs.org'
32+
33+
- name: Update npm
34+
run: npm install -g npm@latest
35+
shell: bash
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
shell: bash
40+
41+
- name: Nx Cloud start
42+
run: pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
43+
shell: bash
44+
env:
45+
CODECOV_TOKEN: ${{ inputs.CODECOV_TOKEN }}
46+
47+
- name: Cache Playwright browsers
48+
uses: actions/cache@v4
49+
with:
50+
path: ~/.cache/ms-playwright
51+
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-playwright-
54+
55+
- name: Install Playwright
56+
run: pnpm exec playwright install
57+
shell: bash
58+
59+
- name: Set Nx SHAs
60+
uses: nrwl/nx-set-shas@v4
61+
62+
- name: Check TS References are Synced
63+
shell: bash
64+
run: pnpm nx sync:check
65+
66+
- name: Run Nx build/lint/test/e2e
67+
run: pnpm exec nx affected -t build lint test e2e-ci
68+
shell: bash
69+
70+
- name: Upload Playwright report
71+
uses: actions/upload-artifact@v4
72+
if: ${{ !cancelled() }}
73+
with:
74+
name: playwright-report
75+
path: |
76+
./e2e/*/.playwright/**
77+
./e2e/**/.playwright/**
78+
retention-days: 30

.github/workflows/ci-fork.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: ForgeRock Fork Pull Request CI
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
actions: read
9+
10+
concurrency:
11+
group: pr-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
pr:
16+
# Only run for forks
17+
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 20
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.pull_request.head.sha }}
25+
fetch-depth: 0
26+
27+
- uses: pnpm/action-setup@v4
28+
with:
29+
run_install: false
30+
31+
- uses: actions/setup-node@v6
32+
with:
33+
node-version-file: '.node-version'
34+
cache: 'pnpm'
35+
cache-dependency-path: '**/pnpm-lock.yaml'
36+
37+
- run: pnpm install --frozen-lockfile
38+
39+
# Restore-only cache to avoid save attempts/noise on forks
40+
- name: Restore Playwright browsers cache
41+
uses: actions/cache/restore@v4
42+
with:
43+
path: ~/.cache/ms-playwright
44+
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-playwright-
47+
48+
- run: pnpm exec playwright install --with-deps
49+
50+
- name: Track base repository main
51+
run: |
52+
git fetch origin +refs/heads/main:refs/remotes/upstream/main
53+
git branch --force main upstream/main
54+
55+
- uses: nrwl/nx-set-shas@v4
56+
57+
- run: pnpm nx format:check
58+
- run: pnpm nx affected -t build typecheck lint test e2e-ci --no-agents

.github/workflows/ci.yml

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
env:
66
NX_CLOUD_ENCRYPTION_KEY: ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }}
77
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.PR_NX_CLOUD_ACCESS_TOKEN }} # Read Only
8-
NX_CLOUD_DISTRIBUTED_EXECUTION: true
98
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
109
CI: true
1110

@@ -16,48 +15,23 @@ concurrency:
1615

1716
jobs:
1817
pr:
18+
if: ${{github.event.pull_request.head.repo.full_name == github.repository}}
1919
runs-on: ubuntu-latest
2020
timeout-minutes: 20
2121
permissions:
2222
pull-requests: write
2323
contents: write
24-
id-token: write
2524
steps:
2625
- uses: actions/checkout@v4
2726
with:
2827
fetch-depth: 0
29-
- uses: pnpm/action-setup@v4
30-
with:
31-
run_install: false
32-
- uses: actions/setup-node@v5
33-
id: cache
34-
with:
35-
node-version-file: '.node-version'
36-
cache: 'pnpm'
37-
38-
- run: pnpm install --frozen-lockfile
28+
token: ${{ secrets.GH_TOKEN }}
3929

40-
# This line enables distribution
41-
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
42-
- run: pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
43-
- run: pnpm nx sync:check
44-
45-
- name: Cache Playwright browsers
46-
uses: actions/cache@v4
30+
- name: Setup Project
31+
uses: ./.github/actions/setup
4732
with:
48-
path: ~/.cache/ms-playwright
49-
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
50-
restore-keys: |
51-
${{ runner.os }}-playwright-
52-
53-
- run: pnpm exec playwright install
33+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5434

55-
- uses: nrwl/nx-set-shas@v4
56-
# This line is needed for nx affected to work when CI is running on a PR
57-
- run: git branch --track main origin/main
58-
59-
- run: pnpm exec nx-cloud record -- nx format:check
60-
- run: pnpm exec nx affected -t build typecheck lint test e2e-ci
6135
- run: npx nx-cloud fix-ci
6236
if: always()
6337

@@ -66,19 +40,8 @@ jobs:
6640
directory: ./packages/
6741
token: ${{ secrets.CODECOV_TOKEN }}
6842

69-
- uses: actions/upload-artifact@v4
70-
if: ${{ !cancelled() }}
71-
with:
72-
name: playwright-report
73-
path: |
74-
**/.playwright
75-
**/test-results
76-
retention-days: 30
77-
7843
- name: Ensure builds run
79-
run: pnpm nx run-many -t build
80-
env:
81-
NX_CLOUD_DISTRIBUTED_EXECUTION: false
44+
run: pnpm nx run-many -t build --no-agents
8245

8346
- run: pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm
8447

0 commit comments

Comments
 (0)