68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
if: github.repository == 'reuters-graphics/graphics-components'
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- id: setup-node
|
|
name: Setup Node.JS
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- id: install-deps
|
|
name: Install dependencies
|
|
run: npm ci
|
|
|
|
- id: build-package
|
|
name: Build package
|
|
run: npm run build:package
|
|
|
|
- id: changesets
|
|
name: Create Release Pull Request or Publish to npm
|
|
uses: changesets/action@v1
|
|
with:
|
|
version: npm run changeset:version
|
|
publish: npm run changeset:publish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- id: build-docs
|
|
name: Build docs
|
|
if: steps.changesets.outputs.published == 'true'
|
|
run: npm run build:docs
|
|
|
|
- id: commit_and_push
|
|
name: Commit and push changes
|
|
if: steps.changesets.outputs.published == 'true'
|
|
run: |
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
git add .
|
|
git commit -m "docs"
|
|
git push
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|