Merge pull request #354 from modelix/fix/LinearHistory #1541
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
jobs: | |
lint-commits: | |
name: Lint PR commits | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v5 | |
test-release: | |
name: Dry-run semantic-release | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Checkout branch | |
# Pretend to semantic-release that the PR result is eligible for | |
# building releases because --dry-run still filters for configured | |
# branches. | |
run: git checkout -b main | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache Node packages | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Dry-run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
# We need to convince semantic-release to not pick up some | |
# configuration from the CI environment by removing the variable that | |
# is used for CI detection. | |
run: unset GITHUB_ACTIONS && npx semantic-release --dry-run --ci false | |
release: | |
name: Run semantic release | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache Node packages | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
run: npx semantic-release |