Skip to content

ci: add stable workflow #1

ci: add stable workflow

ci: add stable workflow #1

Workflow file for this run

name: Publish Developement
on:
push:
branches:
- main
jobs:
publish:
strategy:
fail-fast: false
matrix:
include:
- package: 'lasfoiawbp'
folder: '.'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
always-auth: true
cache: pnpm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install dependencies
run: pnpm install
- name: Publish package
id: publish
run: |
cd ${{ matrix.folder }}
VERSION=$(pnpm version | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?')
echo "Current version: $VERSION"
if [[ $VERSION == *-* ]]; then
pnpm version prerelease --no-git-tag-version --no-commit-hooks
echo "This version has a pre-identifier. Incrementing build number."
else
pnpm version preminor --preid dev --no-git-tag-version --no-commit-hooks
echo "This is a stable version. Setting up dev version."
fi
pnpm publish --provenance --no-git-checks --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Configure git, commit and push!
id: commmit
if: steps.publish.outcome == 'success'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add package.json pnpm-lock.yaml
git commit -m "chore: bump version to $(pnpm version --json | jq -r '.${{ matrix.package }}') [skip ci]" || echo "No changes to commit"
git push
- name: Deprecate older dev versions
if: steps.commmit.outcome == 'success'
run: pnpm exec npm-deprecate --name "*dev*" --message "This version is deprecated. Please use a newer version." --package ${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}