Skip to content

1.0.25

1.0.25 #18

Workflow file for this run

# Trigger is set to target new version tags on the main branch
name: CI
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Matches tags like v1.0.20, v2.3.100, etc.
workflow_dispatch: # Allows manual triggering in GitHub
jobs:
test-build-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.output_version.outputs.version }}
steps:
- name: Assign the version we are building
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION is set to $VERSION"
- name: Output the version for use between jobs
id: output_version
run: |
echo "version=${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "Outputting version: ${{ env.VERSION }}"
- name: Checkout the tagged version
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run build script
run: npm run build
- name: List files in dist after build
run: ls -al ./dist
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: code4ward/JSOI
trigger-npm-publish:
runs-on: ubuntu-latest
needs: test-build-version # Ensures it's dependent and conditional on success
steps:
- name: Trigger workflow via repository dispatch
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # your default GITHUB_TOKEN should work if workflow is in the same repo; custom PAT if triggering cross-repo
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'publish-npm.yaml', // The file name of target workflow file
ref: 'master', // Branch where the triggered workflow is defined
inputs: {
version: "${{ needs.test-build-version.outputs.version }}"
}
});