Build and Publish #9
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: Build and Publish | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - run: npm install | |
| - name: Set version | |
| run: | | |
| CURRENT_VERSION=$(npm pkg get version | tr -d '"') | |
| RELEASE_VERSION="${CURRENT_VERSION%.*}.$(date +%Y%m%d)" | |
| echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
| npm version "$RELEASE_VERSION" --no-git-tag-version | |
| - name: Publish to npm | |
| run: npm publish | |
| - name: Build TCD harmonics files | |
| run: npm run build -w tcd | |
| - name: Rename TCD files for release | |
| run: | | |
| mv packages/tcd/dist/harmonics-metric.tcd "packages/tcd/dist/neaps-${RELEASE_VERSION##*.}-metric.tcd" | |
| mv packages/tcd/dist/harmonics-imperial.tcd "packages/tcd/dist/neaps-${RELEASE_VERSION##*.}-imperial.tcd" | |
| - name: Create GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: v${{ env.RELEASE_VERSION }} | |
| generateReleaseNotes: true | |
| artifacts: "packages/tcd/dist/*.tcd" |