feat: update package version to 0.2.1 in package.json and fix PACKAGE… #5
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*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag name to release (optional when manually triggered)" | |
| required: false | |
| permissions: | |
| contents: write | |
| packages: read | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| env: | |
| PACKAGE_DIR: packages/prettier-plugin-c-sharp | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.tag }}" ]; then | |
| echo "value=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22.21.0 | |
| cache: "npm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Test | |
| run: npm run test | |
| - name: Build packages | |
| run: npm run build | |
| - name: Host smoke test | |
| run: npm run ci:smoke | |
| - name: Build host bundles | |
| run: npm run build:host | |
| - name: Verify package version matches tag | |
| working-directory: ${{ env.PACKAGE_DIR }} | |
| run: | | |
| PACKAGE_VERSION="$(node -pe "require('./package.json').version")" | |
| EXPECTED_TAG="v${PACKAGE_VERSION}" | |
| if [ "${EXPECTED_TAG}" != "${{ steps.tag.outputs.value }}" ]; then | |
| echo "Tag mismatch: expected ${EXPECTED_TAG}, got ${{ steps.tag.outputs.value }}" >&2 | |
| exit 1 | |
| fi | |
| - name: Publish to npm | |
| working-directory: ${{ env.PACKAGE_DIR }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm publish --access public | |
| - name: Package artifacts | |
| run: | | |
| set -euo pipefail | |
| ROOT="$(pwd)" | |
| ARTIFACT_DIR="$ROOT/release-artifacts" | |
| mkdir -p "$ARTIFACT_DIR" | |
| echo "Packing npm artifact..." | |
| npm pack "$PACKAGE_DIR" --pack-destination "$ARTIFACT_DIR" | |
| echo "Packaging host binaries..." | |
| for platform_dir in "$PACKAGE_DIR"/bin/*; do | |
| [ -d "$platform_dir" ] || continue | |
| platform="$(basename "$platform_dir")" | |
| archive="$ARTIFACT_DIR/dixie-host-$platform.zip" | |
| ( | |
| cd "$platform_dir" | |
| zip -r "$archive" . | |
| ) | |
| done | |
| echo "Copying manifest snapshot..." | |
| cp "$PACKAGE_DIR/manifest.json" "$ARTIFACT_DIR/manifest.json" | |
| - name: Upload release artifacts | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.value }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: release-artifacts/** |