Skip to content

Fix v5-alpha action

Fix v5-alpha action #4

Workflow file for this run

name: Publish Alpha podverse-external-services
on:
push:
branches:
- v5-alpha
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.16.0'
registry-url: 'https://registry.npmjs.org'
# Clean install dependencies
- name: Clean install dependencies
run: npm clean-install
# Increment version
- name: Increment alpha version
id: version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [[ "$CURRENT_VERSION" =~ -alpha\.[0-9]+$ ]]; then
BASE_VERSION=$(echo $CURRENT_VERSION | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+)-alpha\.[0-9]+/\1/')
ALPHA_VERSION=$(echo $CURRENT_VERSION | sed -E 's/.*-alpha\.([0-9]+)/\1/')
NEXT_ALPHA_VERSION=$((ALPHA_VERSION + 1))
else
BASE_VERSION=$CURRENT_VERSION
NEXT_ALPHA_VERSION=0
fi
NEXT_VERSION="${BASE_VERSION}-alpha.${NEXT_ALPHA_VERSION}"
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
# Update package.json with the new version
- name: Update package.json
run: |
npm version $NEXT_VERSION --no-git-tag-version
# Build the module
- name: Build module
run: npm run build
# Publish to npm
- name: Publish to npm
run: npm publish --tag alpha
env:
NODE_AUTH_TOKEN: ${{ secrets.ALPHA_NPM_TOKEN }}
# Commit and push the updated version
- name: Commit and push version bump
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add package.json package-lock.json
git commit -m "chore: bump version to $NEXT_VERSION"
git push origin v5-alpha