Skip to content

Commit

Permalink
ci: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Jul 27, 2024
1 parent 01876f1 commit cedd1d3
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 14 deletions.
21 changes: 21 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup
description: Setup the environment

inputs:
node-version:
description: The version of node.js
required: false
default: '20'

runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: yarn

- name: Install
run: yarn install
shell: bash
19 changes: 6 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@ jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 20.x
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: yarn
- uses: actions/checkout@v4

- uses: ./.github/actions/setup

- name: Run tests
run: yarn test

- name: Lint
run: yarn lint

- name: Build
run: yarn build
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
push:
branches:
- master

jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release-please
with:
release-type: node
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}

publish:
runs-on: ubuntu-latest
needs: [version]
if: ${{ needs.version.outputs.release_created }}
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup

- name: Build
run: yarn run build

- name: Publish to NPM
run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit cedd1d3

Please sign in to comment.