Skip to content

chore: record last release sha for release-please #51

chore: record last release sha for release-please

chore: record last release sha for release-please #51

name: Release Please
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
# Checkout code if release was created
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# Setup Node.js for npm publishing
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
# Install dependencies
- run: npm ci
if: ${{ steps.release.outputs.release_created }}
# Build the project
- run: npm run build
if: ${{ steps.release.outputs.release_created }}
# Build reproducible release artifact
- name: Package release artifact
if: ${{ steps.release.outputs.release_created }}
env:
RELEASE_ARTIFACT_DIR: release-artifacts
run: node dist/scripts/create-release-artifact.js
# Upload tarball and checksum to GitHub release
- name: Upload release assets
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.release.outputs.tag_name }}
run: |
set -eu
tarball_path=$(find release-artifacts -maxdepth 1 -name 'webssh2-*.tar.gz' -print -quit)
if [ -z "$tarball_path" ]; then
echo 'tarball not found' >&2
exit 1
fi
checksum_path="${tarball_path}.sha256"
if [ ! -f "$checksum_path" ]; then
echo 'checksum file not found' >&2
exit 1
fi
gh release upload "$RELEASE_TAG" "$tarball_path" "$checksum_path" --clobber
# Publish to npm
- run: npm publish --access public
if: ${{ steps.release.outputs.release_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}