diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..f012cbf --- /dev/null +++ b/.github/actions/setup/action.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a54d074..44df32d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..16356de --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.github/workflows/size.yml b/.github/workflows/size.yml index 6021cda..ab3d1be 100644 --- a/.github/workflows/size.yml +++ b/.github/workflows/size.yml @@ -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 }}