New canary release (0.1.5) #15
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: Canary version Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - develop | |
| jobs: | |
| release: | |
| if: | | |
| github.event.pull_request.merged == true && | |
| contains(github.event.pull_request.labels.*.name, 'release') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Get version and SHA | |
| id: version | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| VERSION_NUM="" | |
| VERSION="${PACKAGE_VERSION}-canary-${SHORT_SHA}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git tag -a "${{ steps.version.outputs.version }}" -m "Canary release ${{ steps.version.outputs.version }}" | |
| git push origin "${{ steps.version.outputs.version }}" | |
| - name: Prepare release contents | |
| id: release_contents | |
| run: | | |
| cat << 'EOF' > pr_body.txt | |
| # 🚀 New Canary Release (`${{ steps.version.outputs.version }}`) | |
| EOF | |
| cat << 'EOF' > pr_body.txt | |
| ${{ github.event.pull_request.body }} | |
| EOF | |
| cat << 'EOF' >> pr_body.txt | |
| ## 📦 Installation | |
| ```bash | |
| npm install --dev @repixelcorp/hyper-pwt@${{ steps.version.outputs.version }} | |
| ``` | |
| ## ⚠️ Warning | |
| This is a canary release and should not be used in production environments. | |
| EOF | |
| echo "body<<EOF" >> $GITHUB_OUTPUT | |
| cat pr_body.txt >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| release_name: 🚀 ${{ steps.version.outputs.version }} | |
| body: ${{ steps.release_contents.outputs.body }} | |
| draft: false | |
| prerelease: true | |
| - name: Update package.json version | |
| run: | | |
| npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version | |
| - name: Build package | |
| run: pnpm build | |
| - name: Publish to NPM | |
| run: | | |
| npm publish --tag canary --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |