From b1316470e2625ca195aba2debed52c2f84a288f0 Mon Sep 17 00:00:00 2001 From: Daniel Grefberg Date: Fri, 7 Jul 2023 17:18:50 +0200 Subject: [PATCH] chore: update GH actions and add release job --- .github/workflows/changesets.yml | 40 +++++++++++++++++++++ .github/workflows/checks.yml | 58 ++++++++++++++++++++++++++++++ .github/workflows/test-linux.yml | 16 --------- .github/workflows/test-macos.yml | 16 --------- .github/workflows/test-windows.yml | 16 --------- package.json | 4 ++- 6 files changed, 101 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/changesets.yml create mode 100644 .github/workflows/checks.yml delete mode 100644 .github/workflows/test-linux.yml delete mode 100644 .github/workflows/test-macos.yml delete mode 100644 .github/workflows/test-windows.yml diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml new file mode 100644 index 0000000..093d1cf --- /dev/null +++ b/.github/workflows/changesets.yml @@ -0,0 +1,40 @@ +name: 'Manage changesets' +on: + workflow_dispatch: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + main: + name: Publish changed packages + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ— Setup repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: ๐Ÿ— Setup Node + uses: actions/setup-node@v2 + with: + node-version: 18.x + cache: yarn + + - name: ๐Ÿ“ฆ Install dependencies + run: yarn install + + - name: ๐Ÿ†• Publish to npm or create release PR + id: changesets + uses: changesets/action@v1 + with: + title: '๐Ÿ†• Upcoming release' + commit: 'chore: version packages' + version: yarn version + publish: yarn release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..d2062bd --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,58 @@ +name: ๐Ÿ•ต๏ธ Checks + +on: + workflow_dispatch: + push: + +jobs: + build: + name: ๐Ÿงฑ Build + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: ๐Ÿ— Setup repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: ๐Ÿ— Setup Node + uses: actions/setup-node@v2 + with: + node-version: 18.x + cache: yarn + + - name: ๐Ÿ“ฆ Install dependencies + run: yarn install + + - name: ๐Ÿงฑ Build project + run: yarn build + + test: + name: ๐Ÿงช Test + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + node-version: [12.x, 18.x] + + runs-on: ${{ matrix.os }} + + steps: + - name: ๐Ÿ— Setup repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: ๐Ÿ— Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + + - name: ๐Ÿ“ฆ Install dependencies + run: yarn install + + - name: ๐Ÿงฑ Build project + run: yarn build diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml deleted file mode 100644 index 82c2a2f..0000000 --- a/.github/workflows/test-linux.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Run tests on Linux - -on: push - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: yarn - - - name: Test package - run: yarn test diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml deleted file mode 100644 index b839b49..0000000 --- a/.github/workflows/test-macos.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Run tests on MacOS - -on: push - -jobs: - test: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: yarn - - - name: Test package - run: yarn test diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml deleted file mode 100644 index 64a8ecb..0000000 --- a/.github/workflows/test-windows.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Run tests on Windows - -on: push - -jobs: - test: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - run: yarn - - - name: Test package - run: yarn test diff --git a/package.json b/package.json index f561ec4..19775c6 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,9 @@ "test": "vitest", "prepare": "yarn build", "lint": "rome check src && prettier --check src", - "lint:fix": "rome check --apply src && prettier --write src" + "lint:fix": "rome check --apply src && prettier --write src", + "version": "changeset version", + "release": "changeset publish" }, "dependencies": { "arg": "^5.0.1",