Fix prepublishOnly: remove pytest dependency from CI publish #9
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 | |
| on: | |
| push: | |
| tags: ['v*'] | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.extract.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - id: extract | |
| name: Extract and validate version | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/v}" | |
| PKG=$(node -p "require('./container/package.json').version") | |
| echo "version=$TAG" >> "$GITHUB_OUTPUT" | |
| if [ "$TAG" != "$PKG" ]; then | |
| echo "::error::Tag v${TAG} does not match package.json version ${PKG}" | |
| exit 1 | |
| fi | |
| publish-and-release: | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 18 | |
| registry-url: https://registry.npmjs.org | |
| - name: Run tests | |
| run: npm test | |
| working-directory: container | |
| - name: Publish to npm | |
| run: npm publish | |
| working-directory: container | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Extract changelog section | |
| id: changelog | |
| run: | | |
| VERSION="${{ needs.validate.outputs.version }}" | |
| NOTES=$(sed -n "/^## \[v${VERSION}\]/,/^## \[v/{ /^## \[v${VERSION}\]/d; /^## \[v/d; p; }" container/.devcontainer/CHANGELOG.md) | |
| if [ -z "$NOTES" ]; then | |
| NOTES="Release v${VERSION}" | |
| fi | |
| echo "$NOTES" > /tmp/release-notes.md | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="v${{ needs.validate.outputs.version }}" | |
| gh release create "$VERSION" \ | |
| --title "$VERSION" \ | |
| --notes-file /tmp/release-notes.md |