diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb9284a..98f6d72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,17 @@ jobs: if: ${{ github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + with: + fetch-depth: 0 + - uses: actions/setup-node@v2 with: node-version: 14.x + cache: yarn - run: yarn install --immutable - - run: yarn tsc - - run: yarn semantic-release + - name: Create release pull request or publish to npm + uses: changesets/action@master + with: + publish: yarn release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 33679e6..6c95fb5 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "scripts": { "lint": "eslint .", "test": "jest", - "format": "prettier --write ." + "format": "prettier --write .", + "release": "./scripts/release.sh" }, "peerDependencies": { "i18next": ">=20" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..5624b1f --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eo pipefail + +if [[ -z "${CI}" ]]; then + echo "Releasing is only allowed from CI." + exit 1 +fi + +yarn tsc +yarn changeset publish