diff --git a/scripts/artifacts/.gitignore b/scripts/artifacts/.gitignore new file mode 100644 index 000000000..a3e60d5ba --- /dev/null +++ b/scripts/artifacts/.gitignore @@ -0,0 +1,4 @@ +*builds/ +*-staged/ +*.zip +*.dmg diff --git a/scripts/artifacts/README.md b/scripts/artifacts/README.md new file mode 100644 index 000000000..dbf948665 --- /dev/null +++ b/scripts/artifacts/README.md @@ -0,0 +1,49 @@ +# Building for release + +## Build Helper workflow + +Our release builds are managed by the "Build Helper" GitHub Action, which is defined +in [`build-helper.yml`](../../.github/workflows/build-helper.yml). + +Under the hood, this will call the `package` task in +[`Taskfile.yml`](../../Taskfile.yml), which will build the Electron codebase using +WebPack and then the `wavesrv` and `mshell` binaries, then it will call `electron-builder` +to generate the distributable app packages. The configuration for `electron-builder` +is [`electron-builder.config.cjs`](../../electron-builder.config.cjs). + +This will also sign and notarize the macOS app package. + +Once a build is complete, it will be placed in `s3://waveterm-github-artifacts/staging-w2/`. +It can be downloaded for testing using the [`download-staged-artifact.sh`](./download-staged-artifact.sh) +script. When you are ready to publish the artifacts to the public release feed, use the +[`publish-from-staging.sh`](./publish-from-staging.sh) script to directly copy the artifacts from +the staging bucket to the releases bucket. + +## Automatic updates + +Thanks to `electron-updater`, we are able to provide automatic app updates for macOS and Linux, +as long as the app was distributed as a DMG, AppImage, RPM, or DEB file. + +With each release, `latest-mac.yml`, `latest-linux.yml`, and `latest-linux-arm64.yml` files will be produced that point to the +newest release. These also include file sizes and checksums to aid in validating the packages. The app +will check these files in our S3 bucket every hour to see if a new version is available. + +### Homebrew + +Homebrew is automatically bumped when new artifacts are published. + +### Linux + +We do not currently submit the Linux packages to any of the package repositories. We +are working on addressing this in the near future. + +## `electron-build` configuration + +Most of our configuration is fairly standard. The main exception to this is that we exclude +our Go binaries from the ASAR archive that Electron generates. ASAR files cannot be executed +by NodeJS because they are not seen as files and therefore cannot be executed via a Shell +command. More information can be found +[here](https://www.electronjs.org/docs/latest/tutorial/asar-archives#executing-binaries-inside-asar-archive). + +We also exclude most of our `node_modules` from packaging, as WebPack handles packaging +of any dependencies for us. The one exception is `monaco-editor`. diff --git a/scripts/artifacts/download-staged-artifact.sh b/scripts/artifacts/download-staged-artifact.sh new file mode 100644 index 000000000..7f9b10c75 --- /dev/null +++ b/scripts/artifacts/download-staged-artifact.sh @@ -0,0 +1,16 @@ +# Downloads the artifacts for the specified version from the staging bucket for local testing. +# Usage: download-staged-artifact.sh +# Example: download-staged-artifact.sh 0.1.0 + +# Retrieve version from the first argument +VERSION=$1 +if [ -z "$VERSION" ]; then + echo "Usage: $0 " + exit +fi + +# Download the artifacts for the specified version from the staging bucket +DOWNLOAD_DIR=$VERSION-staged +rm -rf $DOWNLOAD_DIR +mkdir -p $DOWNLOAD_DIR +aws s3 cp s3://waveterm-github-artifacts/staging-w2/$VERSION/ $DOWNLOAD_DIR/ --recursive --profile $AWS_PROFILE diff --git a/scripts/artifacts/publish-from-staging.sh b/scripts/artifacts/publish-from-staging.sh new file mode 100644 index 000000000..6f31fac81 --- /dev/null +++ b/scripts/artifacts/publish-from-staging.sh @@ -0,0 +1,21 @@ +# Takes a release from our staging bucket and publishes it to the public download bucket. +# Usage: publish-from-staging.sh +# Example: publish-from-staging.sh 0.1.0 + +# Takes the version as an argument +VERSION=$1 +if [ -z "$VERSION" ]; then + echo "Usage: $0 " + exit +fi + +ORIGIN="waveterm-github-artifacts/staging-w2/$VERSION/" +DESTINATION="dl.waveterm.dev/releases-w2/" + +OUTPUT=$(aws s3 cp s3://$ORIGIN s3://$DESTINATION --recursive --profile $AWS_PROFILE) + +for line in $OUTPUT; do + PREFIX=${line%%${DESTINATION}*} + SUFFIX=${line:${#PREFIX}} + echo "https://$SUFFIX" +done