chore(publish): Refine GitHub Actions workflow
- Add a step to verify the release tag - Add a step to publish the release - Enhance the publish node step
This commit is contained in:
99
.github/workflows/publish.yml
vendored
99
.github/workflows/publish.yml
vendored
@@ -1,21 +1,106 @@
|
||||
name: Publish to Comfy registry
|
||||
name: Release and Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
- 'pyproject.toml'
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
name: Release and Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@main
|
||||
|
||||
- name: Get current version
|
||||
id: current_version
|
||||
run: |
|
||||
echo "version=$(cat pyproject.toml | grep 'version =' | cut -d'=' -f2 | xargs)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check if tag exists
|
||||
id: check-tag
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
script: |
|
||||
const tag = `v${{ steps.current_version.outputs.version }}`;
|
||||
try {
|
||||
await github.rest.repos.getReleaseByTag({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
tag
|
||||
});
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return false
|
||||
}
|
||||
|
||||
- name: Assert tag v${{ steps.current_version.outputs.version }} is not exist
|
||||
run: |
|
||||
if [ ${{ steps.check-tag.outputs.result }} == true ]; then
|
||||
echo "Tag exists, skipping release"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Build and Package
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm run build
|
||||
tar -czf dist.tar.gz py/ web/ __init__.py LICENSE pyproject.toml
|
||||
|
||||
- name: Create release draft
|
||||
uses: softprops/action-gh-release@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: |
|
||||
dist.tar.gz
|
||||
name: ${{ steps.current_version.outputs.version }}
|
||||
tag_name: v${{ steps.current_version.outputs.version }}
|
||||
draft: true
|
||||
make_latest: true
|
||||
|
||||
- name: Prepare publish custom node to registry
|
||||
run: |
|
||||
find . -maxdepth 1 ! -name '.' ! -name 'dist.tar.gz' ! -name '.git' -exec rm -rf {} +
|
||||
tar -xzf dist.tar.gz
|
||||
rm -rf dist.tar.gz
|
||||
|
||||
# - name: Publish Custom Node
|
||||
# uses: Comfy-Org/publish-node-action@main
|
||||
# with:
|
||||
# ## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
# personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
#
|
||||
# Publish Custom Node
|
||||
# Copy from Comfy-Org/publish-node-action@main
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install comfy-cli
|
||||
shell: bash
|
||||
run: |
|
||||
pip install comfy-cli
|
||||
|
||||
- name: Publish Node
|
||||
shell: bash
|
||||
run: |
|
||||
comfy --skip-prompt --no-enable-telemetry env
|
||||
comfy node publish --token ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user