From cf568f1149603d29eac10293b7cfef34de7358ed Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 22 Nov 2024 09:36:27 -0500 Subject: [PATCH 1/7] add build workflows --- .github/workflows/create-release.yml | 75 ++++++++++++++++++++++++++++ .github/workflows/pr-build.yml | 44 ++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/pr-build.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..a0cfad7 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,75 @@ +name: Create Release + +on: + push: + branches: + - main + +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 ::set-output name=version::$(node -p "require('./package.json').version") + + - name: Get the PR that was merged into main + id: pr + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { data: pulls } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed', + base: 'main', + sort: 'updated', + direction: 'desc', + per_page: 1 + }); + const pr = pulls[0]; + // Set the title and body as outputs + return { + title: pr.title, + body: pr.body + }; + + - name: Make outputs of previous step available + id: pr-output + run: | + echo "::set-output name=title:$(echo ${{ steps.pr.outputs.result }} | jq -r '.title')" + echo "::set-output name=body::$(echo ${{ steps.pr.outputs.result }} | jq -r '.body')" + + - 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: false + prerelease: false + + - name: Upload release artifacts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ steps.version.outputs.version }} ./bin/comfyui#Linux_x64 --clobber + + diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000..b73db73 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,44 @@ +name: Build Release Candidate + +on: + pull_request: + branches: + - main + +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: Archive production artifacts + id: archive + 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.archive.outputs.artifact-url }}) :rocket:` + }) + From 6185eece2ee6b5da517af9cc70734dc588029e46 Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 22 Nov 2024 09:42:29 -0500 Subject: [PATCH 2/7] path ignore on release --- .github/workflows/create-release.yml | 7 +++++++ docker-compose.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index a0cfad7..2064c25 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -4,6 +4,13 @@ on: push: branches: - main + paths-ignore: + - ".github/**" + - "**.md" + - "**.png" + - ".gitignore" + - "generate-workflow" + - "**.yml" jobs: build-and-release: diff --git a/docker-compose.yml b/docker-compose.yml index 1d66881..e2b12ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: comfyui: - image: saladtechnologies/comfyui:comfy0.2.2-api1.4.1-base + image: saladtechnologies/comfyui:comfy0.2.7-api1.6.0-base volumes: - ./bin:/app/bin command: ["/app/bin/comfyui-api"] From c00b1d7d257c9143aff34fae40e41da20409697c Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 22 Nov 2024 09:43:37 -0500 Subject: [PATCH 3/7] typo --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 2064c25..41fe502 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -77,6 +77,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release upload ${{ steps.version.outputs.version }} ./bin/comfyui#Linux_x64 --clobber + gh release upload ${{ steps.version.outputs.version }} ./bin/comfyui-api#Linux_x64 --clobber From e4f8a097621ec9cb662f992e09e6b142f09b99b0 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 9 Jan 2025 16:54:12 -0500 Subject: [PATCH 4/7] small adjustments --- .github/workflows/create-release.yml | 33 ++++++---------------------- .github/workflows/pr-build.yml | 15 ++++++++++--- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 41fe502..b790965 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -11,6 +11,8 @@ on: - ".gitignore" - "generate-workflow" - "**.yml" + - "test/**" + - "example-workflows/**" jobs: build-and-release: @@ -35,32 +37,11 @@ jobs: run: echo ::set-output name=version::$(node -p "require('./package.json').version") - name: Get the PR that was merged into main - id: pr - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data: pulls } = await github.rest.pulls.list({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'closed', - base: 'main', - sort: 'updated', - direction: 'desc', - per_page: 1 - }); - const pr = pulls[0]; - // Set the title and body as outputs - return { - title: pr.title, - body: pr.body - }; - - - name: Make outputs of previous step available id: pr-output run: | - echo "::set-output name=title:$(echo ${{ steps.pr.outputs.result }} | jq -r '.title')" - echo "::set-output name=body::$(echo ${{ steps.pr.outputs.result }} | jq -r '.body')" + info=$(gh pr list --state merged --limit 1 --json title --json body) + echo "::set-output name=title:$(echo $info | jq -r '.title')" + echo "::set-output name=body:$(echo $info | jq -r '.body')" - name: Create a release uses: actions/create-release@v1 @@ -70,13 +51,13 @@ jobs: tag_name: ${{ steps.version.outputs.version }} release_name: ${{ steps.pr-output.outputs.title }} body: ${{ steps.pr-output.outputs.body }} - draft: false + 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 --clobber + gh release upload ${{ steps.version.outputs.version }} ./bin/comfyui-api#Linux_x64 diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index b73db73..cfd088f 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -4,6 +4,15 @@ on: pull_request: branches: - main + paths-ignore: + - ".github/**" + - "**.md" + - "**.png" + - ".gitignore" + - "generate-workflow" + - "**.yml" + - "test/**" + - "example-workflows/**" jobs: build: @@ -23,8 +32,8 @@ jobs: - name: Build run: npm run build-binary - - name: Archive production artifacts - id: archive + - name: Upload artifact + id: artifact uses: actions/upload-artifact@v4 with: path: bin/comfyui-api @@ -39,6 +48,6 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `:rocket: [Download the latest release candidate](${{ steps.archive.outputs.artifact-url }}) :rocket:` + body: `:rocket: [Download the latest release candidate](${{ steps.artifact.outputs.artifact-url }}) :rocket:` }) From 65b706ef25032e17c97ec2e730d6a9d1965f0ae4 Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 10 Jan 2025 09:29:31 -0500 Subject: [PATCH 5/7] allow manually running release build --- .github/workflows/create-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index b790965..e4f6f7c 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -13,6 +13,7 @@ on: - "**.yml" - "test/**" - "example-workflows/**" + workflow_dispatch: {} jobs: build-and-release: From 1fb762050e19c114db18e20b9c8f8095d5cf3fd3 Mon Sep 17 00:00:00 2001 From: Shawn Date: Mon, 13 Jan 2025 10:45:30 -0500 Subject: [PATCH 6/7] typo in set-output --- .github/workflows/create-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index e4f6f7c..0b729fc 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -41,8 +41,8 @@ jobs: id: pr-output run: | info=$(gh pr list --state merged --limit 1 --json title --json body) - echo "::set-output name=title:$(echo $info | jq -r '.title')" - echo "::set-output name=body:$(echo $info | jq -r '.body')" + echo "::set-output name=title::$(echo $info | jq -r '.title')" + echo "::set-output name=body::$(echo $info | jq -r '.body')" - name: Create a release uses: actions/create-release@v1 From a51d1f99ace8eb3d7f248c83302498c68b79d4a6 Mon Sep 17 00:00:00 2001 From: Shawn Date: Mon, 13 Jan 2025 11:03:45 -0500 Subject: [PATCH 7/7] set-output is deprecated --- .github/workflows/create-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 0b729fc..e38dfab 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -35,14 +35,14 @@ jobs: - name: Get version from package.json id: version - run: echo ::set-output name=version::$(node -p "require('./package.json').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 "::set-output name=title::$(echo $info | jq -r '.title')" - echo "::set-output name=body::$(echo $info | jq -r '.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