Skip to content

Cut New Releases

Cut New Releases #2

# A workflow to cut new releases (i.e.: .stable_00) for various release
# channels.
#
# Supports cutting releases for nightly release channels, weekly release
# channels, or all release channels. Releases run in parallel where able.
name: Cut New Releases
on:
schedule:
# Run this job every morning at 3am EST.
- cron: "0 8 * * *"
workflow_dispatch:
inputs:
targets:
type: choice
description: Which releases to build. Nightly = dev; Weekly = preview/stable.
options:
- nightly
- weekly
- all
env:
CONFIG_FILE: ".github/workflows/release_configurations.json"
# The day of the week when the weekly release should be cut. This is a value
# from 1-7, with 1 representing Monday, 2 representing Tuesday, etc.
WEEKLY_RELEASE_DAY: 3 # Cut weekly builds on Wednesdays.
jobs:
get_config:
name: Get release configuration
runs-on: ubuntu-latest
env:
SCHEDULE: ${{ github.event.schedule }}
TARGETS: ${{ inputs.targets }}
outputs:
channels: ${{ steps.get-config.outputs.channels }}
steps:
- name: Check for master branch
run: |
[ $GITHUB_REF == "refs/heads/master" ] || (echo "::error::Can only cut new releases on the master branch" && exit 1)
shell: bash
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- id: get-config
run: |
# Check to see if this was auto-run as a cron job. If so, set the
# value of TARGETS based on whether the current day of the week
# is when we build weekly releases (in addition to nightly ones).
if [[ ! -z "$SCHEDULE" ]]; then
if [[ "$(date +%u)" == "$WEEKLY_RELEASE_DAY" ]]; then
TARGETS="all"
else
TARGETS="nightly"
fi
fi
echo ::echo::on
if [[ "$TARGETS" == "all" ]]; then
TARGETS="$(jq -rc '[.channels[] | .type] | unique' $CONFIG_FILE)"
else
TARGETS="[\"$TARGETS\"]"
fi
export CHANNELS="$(jq -rc '[.channels[] | select(.type | inside($ENV.TARGETS)) | .channel]' $CONFIG_FILE)"
echo "channels=$CHANNELS" >> $GITHUB_OUTPUT
# CHANNELS_INCLUDE_AUTOPUSH=$(jq -rc '[.channels[] | select(.channel | inside($ENV.CHANNELS)) | .is_autopush] | any' $CONFIG_FILE)
# echo "channels-include-autopush=$CHANNELS_INCLUDE_AUTOPUSH" >> $GITHUB_OUTPUT
echo ::echo::off
shell: bash
create_release:
name: Create Release
uses: ./.github/workflows/create_release.yml
needs: get_config
strategy:
fail-fast: false
matrix:
channel: ${{ fromJSON(needs.get_config.outputs.channels) }}
with:
channel: ${{ matrix.channel }}
secrets: inherit
update_channel_versions:
name: Update channel_versions.json
needs:
- create_release
runs-on: ubuntu-latest
steps:
- name: Invoke update workflow in channel-versions repository
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
repository: warpdotdev/channel-versions
token: ${{ secrets.CHANNEL_VERSIONS_REPOSITORY_DISPATCH_TOKEN }}
event-type: update-channel-versions