Skip to content

Commit

Permalink
ci: reorganise workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 12, 2024
1 parent b1c8e68 commit 533b5a4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 21 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: autofix.ci # needed to securely identify the workflow

on:
pull_request:
push:
branches: [ "main" ]

permissions:
contents: read
Expand All @@ -18,9 +16,15 @@ jobs:
with:
node-version: 20
cache: "pnpm"

- run: pnpm install
- name: Run sync

- name: Lint
run: pnpm lint --fix

- name: Sync
run: pnpm sync
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
25 changes: 7 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,28 @@ jobs:
with:
node-version: 20
cache: "pnpm"

- run: pnpm install

- name: Lint
# these run in the autofix workflow on pull requests
if: github.event_name == 'push'
run: pnpm lint

- name: Test types
run: pnpm tsc --noEmit

- name: Sync
run: pnpm sync
# these run in the autofix workflow on pull requests
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Sync Status
# these run in the autofix workflow on pull requests
if: github.event_name == 'push'
run: git diff --exit-code

- name: Build
run: pnpm build

- uses: dorny/paths-filter@v2
if: github.event_name == 'push'
id: changes
with:
filters: |
modules:
- 'modules/**'
- 'lib/**'
- name: Publish to npm
if: github.event_name == 'push' && steps.changes.outputs.modules == 'true'
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
echo "//registry.pnpmpkg.com/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
pnpm release
env:
NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ci

on:
push:
branches:
- main
paths:
- 'modules/**'
- 'lib/**'

permissions:
contents: read

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- run: pnpm install

- name: Build
run: pnpm build

- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
echo "//registry.pnpmpkg.com/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
pnpm release
env:
NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

0 comments on commit 533b5a4

Please sign in to comment.