Skip to content

fix(site): restore static theme toggle and clarify entry points #80

fix(site): restore static theme toggle and clarify entry points

fix(site): restore static theme toggle and clarify entry points #80

Workflow file for this run

name: Publish Packages
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
on:
push:
branches:
- main
concurrency:
group: publish-packages
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CHANGESETS_GITHUB_TOKEN || github.token }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 24
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Validate
run: pnpm validate
- name: Detect pending changesets
id: changesets
run: |
if find .changeset -maxdepth 1 -name "*.md" ! -name "README.md" ! -name "config.json" | grep -q .; then
echo "has_changesets=true" >> "$GITHUB_OUTPUT"
else
echo "has_changesets=false" >> "$GITHUB_OUTPUT"
fi
- name: Version packages
if: steps.changesets.outputs.has_changesets == 'true'
run: pnpm version-packages
- name: Read release version
if: steps.changesets.outputs.has_changesets == 'true'
id: release_version
run: echo "tag=v$(jq -r '.version' packages/memos-embed/package.json)" >> "$GITHUB_OUTPUT"
- name: Commit versioned packages to main
if: steps.changesets.outputs.has_changesets == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
if git diff --cached --quiet; then
echo "No versioned file changes to commit"
else
git commit -m "chore: release packages"
git push origin HEAD:main
fi
- name: Publish packages
if: steps.changesets.outputs.has_changesets == 'true'
run: pnpm release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
- name: Create release tag
if: steps.changesets.outputs.has_changesets == 'true'
run: |
git tag "${{ steps.release_version.outputs.tag }}"
git push origin "${{ steps.release_version.outputs.tag }}"
- name: Read previous release tag
if: steps.changesets.outputs.has_changesets == 'true'
id: previous_tag
run: |
previous_tag=$(git tag --sort=-v:refname | sed -n '2p')
echo "tag=$previous_tag" >> "$GITHUB_OUTPUT"
- name: Create GitHub release with changelogithub
if: steps.changesets.outputs.has_changesets == 'true'
env:
GITHUB_TOKEN: ${{ secrets.CHANGESETS_GITHUB_TOKEN || github.token }}
run: |
if [ -n "${{ steps.previous_tag.outputs.tag }}" ]; then
pnpm exec changelogithub \
--github "${{ github.repository }}" \
--from "${{ steps.previous_tag.outputs.tag }}" \
--to "${{ steps.release_version.outputs.tag }}" \
--name "${{ steps.release_version.outputs.tag }}" \
--contributors
else
pnpm exec changelogithub \
--github "${{ github.repository }}" \
--to "${{ steps.release_version.outputs.tag }}" \
--name "${{ steps.release_version.outputs.tag }}" \
--contributors
fi