Release 0.0.0-test #10
Workflow file for this run
This file contains hidden or 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: Release | |
| run-name: Release ${{ github.event.inputs.tag || '0.0.0-test' }} | |
| on: | |
| # For testing - remove before merging | |
| push: | |
| branches: | |
| - improvement/CLDSRVCLT-7 | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to be released (e.g., 1.0.0)' | |
| required: true | |
| env: | |
| # Use input tag for workflow_dispatch, or test tag for push events | |
| RELEASE_TAG: ${{ github.event.inputs.tag || '0.0.0-test' }} | |
| jobs: | |
| check: | |
| name: Preliminary checks | |
| runs-on: ubuntu-latest | |
| # Only run check for manual workflow_dispatch (not for push events) | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Ensure version matches tag | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| if [ "$PACKAGE_VERSION" != "${{ env.RELEASE_TAG }}" ]; then | |
| echo "::error file=package.json::Version $PACKAGE_VERSION doesn't match tag ${{ env.RELEASE_TAG }}" | |
| exit 1 | |
| fi | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| # For workflow_dispatch: wait for check. For push: run immediately | |
| needs: check | |
| if: always() && (needs.check.result == 'success' || needs.check.result == 'skipped') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup and Build | |
| uses: ./.github/actions/setup-and-build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| dist/ | |
| build/ | |
| publish-npm: | |
| name: Publish to npm registry | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: success() | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Setup Node.js for npm registry | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: publish-npm | |
| # Only create GitHub release for manual workflow_dispatch (not test pushes) | |
| if: github.event_name == 'workflow_dispatch' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create Git Tag | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag ${{ env.RELEASE_TAG }} | |
| git push origin ${{ env.RELEASE_TAG }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.RELEASE_TAG }} | |
| name: Release ${{ env.RELEASE_TAG }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |