Skip to content

Commit

Permalink
ci: add prepare action (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown authored Mar 27, 2024
1 parent e08e65d commit e8f8021
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 117 deletions.
35 changes: 35 additions & 0 deletions .github/actions/prepare/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Prepare Job
description: Prepare the job by installing required tools and dependencies

runs:
using: 'composite'
steps:
- name: Enable Corepack
run: corepack enable
shell: 'bash -Eeuo pipefail {0}'

- id: setup-node
name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: '.node-version'

- id: cache-node-modules
name: Cache node_modules
uses: actions/cache@v4
with:
key: node-${{ steps.setup-node.outputs.node-version }}-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
path: '**/node_modules'
restore-keys: node-${{ steps.setup-node.outputs.node-version }}-modules-${{ runner.os }}-

- if: steps.cache-node-modules.outputs.cache-hit != 'true' || steps.setup-node.outputs.cache-hit != 'true'
env:
HUSKY: '0'
name: Install dependencies
run: pnpm install
shell: 'bash -Eeuo pipefail {0}'

- name: Build packages
run: pnpm run build
shell: 'bash -Eeuo pipefail {0}'
7 changes: 1 addition & 6 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
addLabels: ['{{{parentDir}}}'],
automergeType: 'pr',
postUpgradeTasks: {
commands: [
'npm install -g pnpm@8',
'pnpm install --frozen-lockfile',
'git checkout -- .npmrc',
'pnpm run format',
],
commands: ['pnpm run bootstrap', 'git checkout -- .npmrc', 'pnpm run format'],
executionMode: 'branch',
},
}
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ branches:
protection:
required_status_checks:
strict: true
contexts: ['Test', 'Renovate / Renovate']
contexts: ['Test', 'Release', 'Renovate / Renovate']
enforce_admins: true
required_pull_request_reviews: null
restrictions: null
Expand Down
36 changes: 11 additions & 25 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: CI
'on':
merge_group:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
Expand All @@ -22,22 +23,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- name: Setup pnpm
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0

- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: pnpm
node-version-file: '.node-version'

- name: Install dependencies and build packages
env:
HUSKY: 0
run: pnpm bootstrap
- name: Prepare job
uses: ./.github/actions/prepare

- name: Check formatting
run: pnpm run check-format
Expand Down Expand Up @@ -66,28 +56,24 @@ jobs:
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
permissions: 'contents:write, issues:write, pull_requests:write'
revoke_token: true

- name: Setup Git user
run: |
git config --global user.email '118100583+bfra-me[bot]@users.noreply.github.com'
git config --global user.name 'bfra-me[bot]'
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
token: ${{ steps.get-workflow-access-token.outputs.token }}
- name: Enable corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: pnpm
node-version-file: '.node-version'
- name: Install dependencies and build packages
env:
HUSKY: 0
run: pnpm bootstrap

- name: Prepare job
uses: ./.github/actions/prepare

- name: Perform a dry run of `pnpm publish`
run: pnpm -r publish --dry-run

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ name: Renovate
default: false
workflow_run:
workflows: ['CI']
branches: ['renovate/**']
types: [completed]

jobs:
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"eslint": "8.57.0",
"prettier": "3.2.5",
"rimraf": "5.0.5",
"ts-node": "10.9.2",
"typescript": "5.4.3"
},
"keywords": [
Expand Down
Loading

0 comments on commit e8f8021

Please sign in to comment.