diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..e38dfab --- /dev/null +++ b/.github/workflows/create-release.yml @@ -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 + + diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000..cfd088f --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -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:` + }) +