Skip to content

Commit

Permalink
chore: update release workflow to test on different node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
danguilherme committed Apr 30, 2024
1 parent 57c174d commit c247cad
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 32 deletions.
93 changes: 62 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@ on:
permissions:
contents: write
jobs:
release:
name: 'Test, Lint, Build and Release'
test:
name: 'Test & Lint'
runs-on: ubuntu-latest
concurrency:
group: test:${{ github.event_name }}:${{ github.ref }}
cancel-in-progress: true
strategy:
matrix:
node-version: ['10.x', '12.x', '14.x', '16.x']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
Expand All @@ -34,33 +37,61 @@ jobs:
# Lint
- name: 📐 Lint
run: yarn lint
# Build
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
# Release
- 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:*' || '' }}
- 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:
semantic_version: 22.0.12 # 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 uno-engine@$NEW_RELEASE_VERSION" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
yarn exec ts-node 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
name: dist
path: dist
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.18.2
v16.20.1

0 comments on commit c247cad

Please sign in to comment.