Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build workflows #10

Merged
merged 8 commits into from
Jan 13, 2025
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
64 changes: 64 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Create Release

on:
push:
branches:
- main
paths-ignore:
- ".github/**"
- "**.md"
- "**.png"
- ".gitignore"
- "generate-workflow"
- "**.yml"
- "test/**"
- "example-workflows/**"
workflow_dispatch: {}

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Build
run: npm run build-binary

- name: Get version from package.json
id: version
run: echo "version=$(jq -r .version package.json) >> $GITHUB_OUTPUT

- name: Get the PR that was merged into main
id: pr-output
run: |
info=$(gh pr list --state merged --limit 1 --json title --json body)
echo "title=$(echo $info | jq -r '.title')" >> $GITHUB_OUTPUT
echo "body=$(echo $info | jq -r '.body')" >> $GITHUB_OUTPUT

- name: Create a release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: ${{ steps.pr-output.outputs.title }}
body: ${{ steps.pr-output.outputs.body }}
draft: true
prerelease: false

- name: Upload release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.version.outputs.version }} ./bin/comfyui-api#Linux_x64


53 changes: 53 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Release Candidate

on:
pull_request:
branches:
- main
paths-ignore:
- ".github/**"
- "**.md"
- "**.png"
- ".gitignore"
- "generate-workflow"
- "**.yml"
- "test/**"
- "example-workflows/**"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Build
run: npm run build-binary

- name: Upload artifact
id: artifact
uses: actions/upload-artifact@v4
with:
path: bin/comfyui-api
name: comfyui-api-${{ github.sha }}

- name: Comment on PR with link
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `:rocket: [Download the latest release candidate](${{ steps.artifact.outputs.artifact-url }}) :rocket:`
})