Skip to content

Commit

Permalink
ci: standardise actions, add pr validation action
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni committed Jan 10, 2025
1 parent fb40f4a commit 666bb8f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 31 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ on:

jobs:
build-dist:
if: github.event.pull_request.merged == true
name: Build dist package
runs-on: ubuntu-latest
name: "Build dist"
if: github.event.pull_request.merged == true
steps:
- name: Check out
uses: actions/checkout@v3
- name: Checkout source code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20
- name: Install packages
run: npm install
- name: Build
run: npm run build
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
add: 'dist'
message: 'chore: build dist package'
add: dist
message: "chore: build dist package"
16 changes: 8 additions & 8 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ on:

jobs:
build-then-bump:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
name: Build dist package, bump version, create changelog
runs-on: ubuntu-latest
name: "Build dist, bump version, create changelog"
if: "!startsWith(github.event.head_commit.message, 'bump:')"
steps:
- name: Check out
uses: actions/checkout@v3
- name: Checkout source code
uses: actions/checkout@v4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20
- name: Install packages
run: npm install
- name: Build
run: npm run build
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
add: 'dist'
message: 'chore: build dist package'
add: dist
message: "chore: build dist package"
push: false
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ on:

jobs:
build-pages:
if: "startsWith(github.event.head_commit.message, 'bump:')"
name: Rebuild and deploy docs on version bump
runs-on: ubuntu-latest
name: "Rebuild and deploy docs on version bump"
if: "startsWith(github.event.head_commit.message, 'bump:')"
steps:
- name: Check out
uses: actions/checkout@v3
- name: Checkout source code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20
- name: Install packages
run: npm install
- name: Build
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ name: Upload NPM Package

on:
release:
types: [published]
types:
- published

jobs:
deploy:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Checkout source code
uses: actions/checkout@v4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Publish package
run: npm publish
env:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Validate pull requests

on:
pull_request:
types: [opened, edited, reopened, synchronize]

jobs:
validate-commits:
name: Validate commit messages
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Check commit message format
uses: webiny/[email protected]
with:
allowed-commit-types: 'feat,fix,refactor,perf,docs,style,test,build,ci,chore,new,patch,revert,ui,merge'
pre-commit:
name: Run pre-commit checks
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Run pre-commit
uses: pre-commit/[email protected]
6 changes: 3 additions & 3 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:

jobs:
sync-branches:
name: Sync dev and patch branches to latest commit
runs-on: ubuntu-latest
name: "Sync dev and patch branches to latest commit"
steps:
- name: Check out
uses: actions/checkout@v3
- name: Checkout source code
uses: actions/checkout@v4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
Expand Down

0 comments on commit 666bb8f

Please sign in to comment.