Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 58 additions & 70 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,59 +10,21 @@ jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4.4.0
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install

check-renovate-changefile:
if: startsWith(github.event.pull_request.head.ref, 'renovate/') && github.base_ref == github.event.repository.default_branch
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.RENOVATE_AUTO_BEACHBALL_CHANGEFILE_TOKEN }}

# Install dependencies (example using pnpm)
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install

- name: Check and generate changefile for Renovate
# Pin to the last commit on main before this action was removed (replaced by renovate-auto-version-plan)
uses: RightCapitalHQ/frontend-style-guide/.github/actions/renovate-auto-beachball-changefile@e7e6cdd89b0a5e56bb7b1b5280aae241d9e4e848

check-beachball-changefile:
if: github.base_ref == github.event.repository.default_branch
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4.4.0
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install

- name: Check
run: pnpm exec beachball check

test:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4.4.0
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: pnpm
Expand All @@ -77,40 +39,66 @@ jobs:
- name: Test
run: pnpm run test

build:
if: ${{ always() && !failure() && !cancelled() }}
needs: [test, check-beachball-changefile]
check-version-plan:
needs: install
if: github.base_ref == github.event.repository.default_branch && github.head_ref != 'release' && !startsWith(github.head_ref, 'renovate/')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4.4.0
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Prepare pnpm
uses: pnpm/action-setup@v4

- name: Prepare Node.js
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install

- name: Build
run: pnpm run build
- name: Install dependencies
run: pnpm install

- name: Publish (development)
if: >-
github.repository == 'RightCapitalHQ/phpdoc-parser' &&
(github.base_ref == github.event.repository.default_branch ||
(github.event_name == 'workflow_dispatch' && github.ref_name != github.event.repository.default_branch))
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
preid="${HEAD_REF//\//-}".${{ github.run_number }}.${{ github.run_attempt }}
npm --no-git-tag-version version prerelease --preid="${preid}"
pnpm publish --no-git-checks --access public --tag development
- name: Set SHAs for Nx
uses: nrwl/nx-set-shas@v4

- name: Check version plan
run: pnpm exec nx release plan:check

check-renovate-version-plan:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
needs: install
if: startsWith(github.event.pull_request.head.ref, 'renovate/') && github.base_ref == github.event.repository.default_branch
uses: RightCapitalHQ/actions/.github/workflows/nx-release-auto-plan.yml@nx-release-auto-plan/v0.4.2
secrets: inherit

- name: Publish (main)
if: github.repository == 'RightCapitalHQ/phpdoc-parser' && github.ref_name == github.event.repository.default_branch
prerelease:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
if: >-
!failure() && !cancelled()
&& github.event_name == 'pull_request'
&& github.event.pull_request.head.repo.full_name == 'RightCapitalHQ/phpdoc-parser'
&& github.base_ref == github.event.repository.default_branch
&& github.head_ref != 'release'
needs: [test, check-version-plan, check-renovate-version-plan]
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ secrets.RC_BOT_APP_ID }}
private-key: ${{ secrets.RC_BOT_PRIVATE_KEY }}
permission-actions: write
- name: Trigger prerelease workflow
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
BRANCH_NAME: ${{ github.head_ref }}
RUN_NUMBER: ${{ github.run_number }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
git config --local user.email "npm-publisher@rightcapital.com"
git config --local user.name "GitHub Actions[bot]"
pnpm beachball publish --access public --yes -m 'chore(release): applying package updates'
gh workflow run release.yml \
--repo "$GITHUB_REPOSITORY" \
-f prerelease=true \
-f "branch_name=${BRANCH_NAME}" \
-f "run_number=${RUN_NUMBER}" \
-f "run_attempt=${RUN_ATTEMPT}"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
15 changes: 15 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release PR

on:
push:
branches: [main]
workflow_dispatch:

jobs:
create-release-pr:
uses: RightCapitalHQ/actions/.github/workflows/nx-release-pr.yml@nx-release-pr/v0.4.2
with:
release-branch: release
base: main
pr-title: 'chore(release): release packages'
secrets: inherit
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
pull_request:
types: [closed]
branches: [main]

workflow_dispatch:
inputs:
prerelease:
required: true
type: boolean
branch_name:
required: true
type: string
run_number:
required: true
type: string
run_attempt:
required: true
type: string

jobs:
release:
if: >-
github.event_name == 'pull_request'
&& github.event.pull_request.merged == true
&& github.event.pull_request.head.ref == 'release'
uses: RightCapitalHQ/actions/.github/workflows/nx-release.yml@nx-release/v0.4.2
with:
publish: true
secrets: inherit

prerelease:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
if: inputs.prerelease
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.branch_name }}
persist-credentials: false
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install

- name: Publish prerelease (development)
env:
BRANCH_NAME: ${{ inputs.branch_name }}
RUN_NUMBER: ${{ inputs.run_number }}
RUN_ATTEMPT: ${{ inputs.run_attempt }}
NPM_CONFIG_PROVENANCE: true
run: |
preid="${BRANCH_NAME//\//-}".${RUN_NUMBER}.${RUN_ATTEMPT}
npm --no-git-tag-version version prerelease --preid="${preid}"
pnpm publish --no-git-checks --access public --tag development
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ dist/

### JetBrains development tool ###
/.idea

# nx
/.nx/cache
/.nx/workspace-data
!/.nx/version-plans/
5 changes: 5 additions & 0 deletions .nx/version-plans/migrate-to-nx-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rightcapital/phpdoc-parser": patch
---

Migrate from beachball to Nx Release workflow.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# We need to ignore this cause this is auto-generated file
pnpm-lock.yaml
CHANGELOG.md
CHANGELOG.json
.nx/version-plans/
Loading
Loading