diff --git a/.github/workflows/prerelease-checks.yml b/.github/workflows/prerelease-checks.yml new file mode 100644 index 00000000..d9a30aba --- /dev/null +++ b/.github/workflows/prerelease-checks.yml @@ -0,0 +1,18 @@ +name: Pre-release checks + +on: + workflow_call: + +jobs: + + check-commit-ancestor: + name: Check commit ancestor + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Check commit has been pushed on origin/main + run: | + git fetch --quiet origin main + git merge-base --is-ancestor HEAD origin/main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..878b65a0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release npm module + +on: + push: + branches: + - release/* + +jobs: + + pre-release-check: + uses: cucumber/cucumber-react/.github/workflows/prerelease-checks.yml@add-release-workflow + + test: + uses: cucumber/cucumber-react/.github/workflows/test.yml@add-release-workflow + + publish-npm: + name: Publish NPM module + needs: [pre-release-check, test] + runs-on: ubuntu-latest + environment: Release + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '16' + cache: 'npm' + cache-dependency-path: package-lock.json + + - run: npm install-ci-test + + - run: npm run compile + + - uses: cucumber/action-publish-npm@v1.0.0 + with: + npm-token: ${{ secrets.NPM_TOKEN }} + + create-github-release: + name: Create GitHub Release and Git tag + needs: [publish-npm] + runs-on: ubuntu-latest + environment: Release + permissions: + contents: write + + steps: + - uses: actions/checkout@v2 + - uses: cucumber/action-create-github-release@v1.1.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca8038cb..d45248a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - main + workflow_call: jobs: test: diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..71e0bb87 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1 @@ +See [.github/RELEASING](https://github.com/cucumber/.github/blob/main/RELEASING.md).