Setup Node 18 in CI (#1237) #52
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: Publish NPM Library | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'library/**' | |
- '.github/**' | |
env: | |
# Workaround testsuite locale issue | |
LANG: en_US.UTF-8 | |
BIT_TOKEN: ${{ secrets.BIT_TOKEN }} | |
jobs: | |
publish: | |
name: "Release @quarkusio/code-quarkus library to npm" | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[npm-release]')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: n1hility/cancel-previous-runs@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Yarn Packages | |
id: yarn-cache | |
uses: actions/cache@v1 | |
with: | |
path: /.cache/yarn | |
key: ${{ runner.os }}-yarn-${{ hashFiles('frontend/yarn.lock', 'lib/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.bvm | |
key: ${{ runner.os }}-bvm-bit | |
restore-keys: | | |
${{ runner.os }}-bvm-bit | |
- name: Install library packages | |
working-directory: library | |
run: yarn --frozen-lockfile | |
- name: Publish Library | |
working-directory: library | |
run: | | |
yarn ci-config | |
yarn run publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Update library in frontend | |
working-directory: frontend | |
run: yarn upgrade @quarkusio/code-quarkus.components --latest | |
- name: Check for .bitmap changes | |
run: | | |
if git diff --exit-code ./library/.bitmap; then | |
echo "BITMAP_CHANGED=false" >> $GITHUB_ENV | |
else | |
echo "BITMAP_CHANGED=true" >> $GITHUB_ENV | |
fi | |
- name: Commit changes made to .bitmap | |
if: ${{ env.BITMAP_CHANGED == 'true' }} | |
run: | | |
git config --global user.name '${{ github.actor }}' | |
git config --global user.email '${{ github.actor }}@users.noreply.github.com' | |
git add frontend/package.json | |
git add frontend/yarn.lock | |
git add library/.bitmap | |
git commit -m "[npm-release] Automated release @quarkusio/code-quarkus library to npm" | |
git push |