Experiment with a new docs? #235
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: | |
- '*' | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
npm-install: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: npm cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-npm-install-${{ hashFiles('package-lock.json', 'package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-install- | |
- name: npm install | |
run: | | |
npm install | |
lint: | |
runs-on: ubuntu-latest | |
needs: | |
- npm-install | |
steps: | |
- uses: actions/checkout@v3 | |
- name: npm cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-npm-install-${{ hashFiles('package-lock.json', 'package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-install- | |
- name: lint | |
run: | | |
npm run lint | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- npm-install | |
steps: | |
- uses: actions/checkout@v3 | |
- name: npm cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-npm-install-${{ hashFiles('package-lock.json', 'package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-install- | |
- name: test | |
run: | | |
npm run test | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
steps: | |
- name: checkout | |
uses: actions/checkout@main | |
with: | |
token: ${{ secrets.TOKEN }} | |
- name: setup node | |
uses: actions/setup-node@main | |
with: | |
node-version: 18.x | |
registry-url: 'https://registry.npmjs.org' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: npm cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-npm-install-${{ hashFiles('package-lock.json', 'package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-install- | |
- name: build cache | |
uses: actions/cache@v3 | |
with: | |
path: packages/**/lib/** | |
key: ${{ runner.os }}-${{ github.sha }}-build | |
restore-keys: | | |
${{ runner.os }}-${{ github.sha }}-build | |
# build is use just to know all the libs transpiles, but for exported package, only | |
# sources are used | |
- name: build | |
run: | | |
npm run build | |
version: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
changes: ${{ steps.version.outputs.changes }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
token: ${{ secrets.TOKEN }} | |
- name: npm cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-npm-install-${{ hashFiles('package-lock.json', 'package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-install- | |
- name: Version | |
id: version | |
run: | | |
(npx changeset version 2>&1 | grep -q 'No unreleased changesets found' && echo 'changes=false' || echo 'changes=true') >> $GITHUB_OUTPUT | |
- name: With Changes | |
if: steps.version.outputs.changes == 'true' | |
run: | | |
git config user.name "Marek Hanzal" | |
git config user.email "[email protected]" | |
git add -A | |
git commit -m "Version bump" || echo "No changes to commit" | |
git push | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- version | |
if: github.ref == 'refs/heads/main' && needs.version.outputs.changes == 'false' | |
steps: | |
- name: checkout | |
uses: actions/checkout@main | |
with: | |
token: ${{ secrets.TOKEN }} | |
- name: setup node | |
uses: actions/setup-node@main | |
with: | |
node-version: 18.x | |
registry-url: 'https://registry.npmjs.org' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: npm cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-npm-install-${{ hashFiles('package-lock.json', 'package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-install- | |
- name: build cache | |
uses: actions/cache@v3 | |
with: | |
path: packages/**/lib/** | |
key: ${{ runner.os }}-${{ github.sha }}-build | |
restore-keys: | | |
${{ runner.os }}-${{ github.sha }}-build | |
- name: Release packages | |
uses: changesets/action@v1 | |
with: | |
publish: npx changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} |