chore: enable corepack before node setup and latest versions of Githu… #3
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: 'Build & Publish' | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
permissions: | |
contents: write | |
jobs: | |
test: | |
name: 'Test & Lint Code' | |
runs-on: ubuntu-latest | |
concurrency: | |
group: test:${{ github.event_name }}:${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
# - name: 📐 Lint | |
# run: yarn lint | |
- name: 🧪 Test | |
run: yarn test | |
build: | |
name: 'Build' | |
runs-on: ubuntu-latest | |
concurrency: | |
group: build:${{ github.event_name }}:${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: 📦 Build | |
run: yarn build | |
- name: ⬆️ Upload built library | |
uses: actions/upload-artifact@v4 # upload built files to be used in release job | |
with: | |
name: dist | |
path: dist | |
retention-days: 1 | |
release: | |
name: 'Release' | |
needs: [test, build] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
packages: write | |
concurrency: | |
group: release:${{ github.event_name }}:${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: ⬇️ Download built library | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: 🚀 Semantic Release | |
id: release | |
uses: cycjimmy/semantic-release-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG == 'true' && 'semantic-release:*' || '' }} | |
with: | |
semantic_version: 23.0.8 # semantic-release version, same as in package.json | |
- name: 📝 Add release notes to build summary | |
if: steps.release.outputs.new_release_published == 'true' | |
run: | | |
NEW_RELEASE_VERSION=${{ steps.release.outputs.new_release_version }} | |
echo "# New package version published: \`v$NEW_RELEASE_VERSION\`" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
echo "yarn add @spread-ai/studio-essentials@$NEW_RELEASE_VERSION" >> $GITHUB_STEP_SUMMARY | |
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
yarn exec ts-node-esm build/append-to-file.ts $GITHUB_STEP_SUMMARY <<"END_OF_CONTENT" | |
${{ steps.release.outputs.new_release_notes }} | |
END_OF_CONTENT | |
- name: ∅ No new package published | |
if: steps.release.outputs.new_release_published == 'false' | |
run: | | |
echo "# No new version published" >> $GITHUB_STEP_SUMMARY |