Skip to content

Commit

Permalink
chore: fix release pipeline (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmvilas authored Oct 28, 2024
1 parent c66dd3a commit 9d3900f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 171 deletions.
134 changes: 0 additions & 134 deletions .github/workflows/if-nodejs-release.yml

This file was deleted.

71 changes: 34 additions & 37 deletions .github/workflows/release-with-changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,57 @@ on:

jobs:
test-nodejs:
# We just check the message of the first commit as there is always just one commit because we squash into one before merging
# "commits" contains an array of objects where one of the properties is the commit "message"
# Release workflow will be skipped if release conventional commits are not used
if: |
startsWith( github.repository, 'asyncapi/' )
name: Test NodeJS release on ${{ matrix.os }}
name: Test NodeJS PR - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- name: Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows
- id: should_run
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
shell: bash
- if: steps.should_run.outputs.shouldrun == 'true'
name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
shell: bash
- name: Checkout repository
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v4
- name: Check if Node.js project and has package.json
id: packagejson
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash
- if: steps.packagejson.outputs.exists == 'true'
name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
- if: steps.packagejson.outputs.exists == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "${{ steps.lockversion.outputs.version }}"
- if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest'
name: Install npm cli 8
node-version: 20
- if: steps.should_run.outputs.shouldrun == 'true'
uses: pnpm/action-setup@v3
with:
run_install: false
- if: steps.should_run.outputs.shouldrun == 'true'
name: Get pnpm store directory
shell: bash
# npm cli 10 is buggy because of some cache issues
run: npm install -g [email protected]
- if: steps.packagejson.outputs.exists == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- if: steps.should_run.outputs.shouldrun == 'true'
uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- if: steps.should_run.outputs.shouldrun == 'true'
name: Install dependencies
shell: bash
run: npm ci
- if: steps.packagejson.outputs.exists == 'true'
name: Run test
run: npm test --if-present
- if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
name: Report workflow run status to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: "Release workflow failed in testing job"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
run: pnpm install
- if: steps.should_run.outputs.shouldrun == 'true'
name: Test
run: pnpm test


release:
needs: [test-nodejs]
Expand Down

0 comments on commit 9d3900f

Please sign in to comment.