Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions .github/workflows/publish-on-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish on Release Branch
name: Publish m-render on Release

on:
create:
push:
branches:
- release/**

Expand All @@ -18,7 +18,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
Expand All @@ -27,16 +27,29 @@ jobs:
- name: Extract version from branch name
id: version
run: |
BRANCH="${GITHUB_REF##refs/heads/release/}"
echo "VERSION=$BRANCH" >> $GITHUB_OUTPUT
VERSION="${GITHUB_REF##refs/heads/release/}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Set version in internal package.json
- name: Set version in package.json if needed
id: maybe-update-version
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
jq --arg v "$VERSION" '.version = $v' libs/m-render/package.json > tmp.$$.json
mv tmp.$$.json libs/m-render/package.json
CURRENT=$(jq -r .version libs/m-render/package.json)
echo "Current version: $CURRENT"
echo "Target version: $VERSION"

- name: Commit and push version bump
if [ "$VERSION" = "$CURRENT" ]; then
echo "Version already set to $VERSION, skipping update."
echo "UPDATED=false" >> $GITHUB_OUTPUT
else
echo "Updating version to $VERSION"
jq --arg v "$VERSION" '.version = $v' libs/m-render/package.json > tmp.$$.json
mv tmp.$$.json libs/m-render/package.json
echo "UPDATED=true" >> $GITHUB_OUTPUT
fi

- name: Commit and push version update
if: steps.maybe-update-version.outputs.UPDATED == 'true'
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
Expand All @@ -47,9 +60,22 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build library
run: npx nx run m-render:build:production
run: npx nx run m-render:build:production --skip-nx-cache

- name: Set up .npmrc for publishing
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish library
run: npx nx run m-render:nx-release-publish
run: npx nx run m-render:nx-release-publish --skip-nx-cache
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create and push git tag
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
git tag v$VERSION
git push origin v$VERSION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion libs/m-render/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@foblex/m-render",
"version": "2.7.0",
"version": "2.7.2",
"description": "MRender is a static site generator designed for creating fast and user-friendly documentation sites based on Markdown files. MarkEngine supports extended Markdown syntax and can render Angular components directly from Markdown files.",
"author": "Siarhei Huzarevich",
"license": "MIT",
Expand Down