Skip to content

Commit

Permalink
Use Github Release to trigger prod builds (#550)
Browse files Browse the repository at this point in the history
* Don't build using async.

* Don't build async.

* Tag release.

* Create test release.

* Test on release.

* Remove prerelease status.

* Update notes.

* Only update github release if it's passed as input.

* Update release instructions.

* Clarify manual instructions.

* Update readme.

* Update .github/actions/build/todesktop/action.yml

Co-authored-by: filtered <[email protected]>

---------

Co-authored-by: Chenlei Hu <[email protected]>
Co-authored-by: filtered <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent e3d6fa2 commit aec5ea6
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ inputs:
description: 'Build Staging'
default: 'false'
required: false
RELEASE_TAG:
description: 'Release Tag'
required: false
runs:
using: composite
steps:
Expand Down Expand Up @@ -52,5 +55,41 @@ runs:
yarn run publish:staging
else
echo "🚀 Building PRODUCTION version..."
yarn run publish
yarn run publish | tee build.log
# Extract build ID from the log
BUILD_URL=$(grep "Build complete!" build.log | head -n1 | cut -d' ' -f3)
BUILD_ID=$(echo $BUILD_URL | cut -d'/' -f6)
APP_ID=$(echo $BUILD_URL | cut -d'/' -f5)
# Only update release notes if RELEASE_TAG is provided
if [ -n "${{ inputs.RELEASE_TAG }}" ]; then
# Create download links section
DOWNLOAD_LINKS="
### Download Latest:
Mac (Apple Silicon): https://download.comfy.org/mac/dmg/arm64
Windows: https://download.comfy.org/windows/nsis/x64
<details>
<summary>
### Artifacts of current release
</summary>
Mac (Apple Silicon): https://download.comfy.org/${BUILD_ID}/mac/dmg/arm64
Windows: https://download.comfy.org/${BUILD_ID}/windows/nsis/x64"
</details>
# First get existing release notes
EXISTING_NOTES=$(gh release view ${{ inputs.RELEASE_TAG }} --json body -q .body)
# Combine existing notes with download links
UPDATED_NOTES="${EXISTING_NOTES}${DOWNLOAD_LINKS}"
# Update the release with combined notes
gh release edit ${{ inputs.RELEASE_TAG }} --notes "$UPDATED_NOTES"
fi
fi
17 changes: 12 additions & 5 deletions .github/workflows/publish_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@ name: Publish All Platforms

on:
workflow_dispatch:
pull_request:
types: [closed]
inputs:
release_tag:
description: 'Release tag to publish (e.g., v0.4.2)'
required: false
type: string
release:
types: [published]

jobs:
build-todesktop:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'Release'))
github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Build
uses: ./.github/actions/build/windows/todesktop
uses: ./.github/actions/build/todesktop
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_ORG_TOKEN}}
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
TODESKTOP_ACCESS_TOKEN: ${{secrets.TODESKTOP_ACCESS_TOKEN}}
TODESKTOP_EMAIL: ${{secrets.TODESKTOP_EMAIL}}
STAGING: 'false'
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,13 @@ The launch environment can be customised, e.g. add a `"linux"` section to source

We use Todesktop to build and codesign our distributables. To make a new release:

1. Make a PR with the semantic version. eg. `v1.0.1`
1. Add the label `Release` to the PR.
1. Merge the PR
1. A build will automatically start and you can view it at https://app.todesktop.com
1. Create a PR that updates package.json to the next version.
1. Create a Github Release with semantic version tag eg. "v1.0.0"
1. Make sure it is a pre-release.
1. Check the Github action "Publish All" runs. It should update the release body with Download links when it is finished.
1. Test the build, and if it looks good release it on ToDesktop. Also mark the release as "Latest".

If a build fails for some reason, you can manually retry by running the "Publish All" GH action with a release tag as input.

### Publish Locally

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"notarize": "node debug/notarize.js",
"package": "yarn run vite:compile && todesktop build --code-sign=false --async",
"postinstall": "node .husky/install.mjs",
"publish": "yarn run vite:compile && todesktop build --async",
"publish": "yarn run vite:compile && todesktop build",
"publish:staging": "yarn run vite:compile && todesktop build --config=./todesktop.staging.json --async",
"reset-install": "node scripts/resetInstall.js",
"sign": "node debug/sign.js",
Expand Down

0 comments on commit aec5ea6

Please sign in to comment.