2023-12-11 13:58:43 +00:00
|
|
|
# Use this workflow to trigger stable releases, both minor releases and patches
|
2023-12-05 11:52:09 +00:00
|
|
|
|
2023-12-11 13:58:43 +00:00
|
|
|
name: Stable release
|
|
|
|
|
2023-12-15 21:53:25 +00:00
|
|
|
run-name: "Stable release '${{ inputs.branch }}' (publish: ${{ inputs.publish }}, latest: ${{ inputs.branch == 'releases/beta' || inputs.latest }}, HTTP compression: ${{ inputs.http-compression }}, ML: ${{ inputs.ml }})"
|
2022-09-22 13:56:27 +00:00
|
|
|
|
|
|
|
on:
|
2023-12-05 11:52:09 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2023-12-11 13:58:43 +00:00
|
|
|
branch:
|
2023-12-05 11:52:09 +00:00
|
|
|
required: true
|
|
|
|
type: string
|
2023-12-11 13:58:43 +00:00
|
|
|
description: "The github branch of this release. Should be 'releases/beta' or 'patches/x.y'"
|
|
|
|
default: releases/beta
|
2023-12-05 11:52:09 +00:00
|
|
|
latest:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Consider this release as the latest one and update the Docker image tag and the binary pointer for the installers"
|
|
|
|
publish:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Publish the release"
|
2023-12-15 21:53:25 +00:00
|
|
|
http-compression:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
description: "Enable HTTP compression in binaries"
|
|
|
|
ml:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
description: "Enable ML support in binaries"
|
2022-09-22 13:56:27 +00:00
|
|
|
|
2023-03-30 20:14:06 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2023-12-11 13:58:43 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
|
2022-09-22 13:56:27 +00:00
|
|
|
jobs:
|
2023-12-05 11:52:09 +00:00
|
|
|
checks:
|
|
|
|
name: Pre-release checks
|
2023-08-04 15:39:50 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-22 13:56:27 +00:00
|
|
|
steps:
|
2023-12-11 13:58:43 +00:00
|
|
|
- name: Verify that the provided branch is either a release branch or a patch branch
|
2023-12-05 11:52:09 +00:00
|
|
|
run: |
|
2023-12-06 14:46:23 +00:00
|
|
|
set -x
|
2023-12-11 13:58:43 +00:00
|
|
|
if [[ "${{ inputs.branch }}" == "releases/beta" || "${{ inputs.branch }}" == "patches/"* ]]; then
|
|
|
|
exit 0
|
2023-12-06 14:46:23 +00:00
|
|
|
else
|
2023-12-11 13:58:43 +00:00
|
|
|
echo "Branch should either be 'releases/beta' or 'patches/x.y'"
|
|
|
|
exit 1
|
2023-12-06 14:46:23 +00:00
|
|
|
fi
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
release:
|
|
|
|
name: Prepare release
|
|
|
|
needs: [checks]
|
|
|
|
uses: ./.github/workflows/reusable_publish_version.yml
|
|
|
|
with:
|
2023-12-15 21:53:25 +00:00
|
|
|
environment: stable
|
2023-12-11 13:58:43 +00:00
|
|
|
git-ref: ${{ inputs.branch }}
|
|
|
|
latest: ${{ inputs.branch == 'releases/beta' || inputs.latest }}
|
|
|
|
publish: ${{ inputs.publish }}
|
|
|
|
create-release: ${{ inputs.publish }}
|
2023-12-15 21:53:25 +00:00
|
|
|
http-compression: ${{ inputs.http-compression }}
|
|
|
|
ml: ${{ inputs.ml }}
|
2023-12-05 11:52:09 +00:00
|
|
|
secrets: inherit
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
release-branch:
|
|
|
|
name: Bump main version
|
|
|
|
needs: [release]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ inputs.branch }}
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
if: ${{ inputs.branch == 'releases/beta' || inputs.latest }}
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
|
|
|
|
- name: Install a TOML parser
|
|
|
|
if: ${{ inputs.branch == 'releases/beta' || inputs.latest }}
|
|
|
|
run: cargo install --force --locked --version 0.8.1 taplo-cli
|
|
|
|
|
|
|
|
- name: Create version bump branch
|
|
|
|
id: bump
|
|
|
|
if: ${{ inputs.branch == 'releases/beta' || inputs.latest }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
2023-12-12 12:45:17 +00:00
|
|
|
# When moving from beta we are going to pull the version from the stable branch
|
|
|
|
if [[ "${{ inputs.branch }}" == "releases/beta" ]]; then
|
|
|
|
git fetch origin releases/stable
|
|
|
|
git checkout releases/stable
|
|
|
|
fi
|
|
|
|
|
2023-12-11 13:58:43 +00:00
|
|
|
# Retrieve just released version
|
|
|
|
version=$(/home/runner/.cargo/bin/taplo get -f lib/Cargo.toml "package.version")
|
|
|
|
echo "version=${version}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
# Checkout the main branch
|
|
|
|
git fetch origin main
|
|
|
|
git checkout main
|
|
|
|
|
|
|
|
# Switch to version bump branch
|
|
|
|
git checkout -b version-bump/v${version}
|
|
|
|
|
|
|
|
# Bump the crate version
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${version}\"#" Cargo.toml
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
|
|
|
|
|
|
|
# Update Cargo.lock without updating dependency versions
|
|
|
|
cargo check --no-default-features --features storage-mem
|
|
|
|
|
|
|
|
- name: Push the branch
|
|
|
|
if: ${{ inputs.publish && (inputs.branch == 'releases/beta' || inputs.latest) }}
|
|
|
|
run: |
|
|
|
|
# Configure git
|
|
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config user.name "github-actions[bot]"
|
|
|
|
git config --add --bool push.autoSetupRemote true
|
|
|
|
|
|
|
|
# Commit changes
|
|
|
|
git commit -am "Bump version to v${{ steps.bump.outputs.version }}"
|
|
|
|
git push
|
|
|
|
|
|
|
|
- name: Create a PR
|
|
|
|
id: pr
|
|
|
|
if: ${{ inputs.publish && (inputs.branch == 'releases/beta' || inputs.latest) }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
url=$(gh pr create --base main --title "Bump version to v${{ steps.bump.outputs.version }}" --body "Update main version")
|
|
|
|
echo "url=${url}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Merge the PR
|
|
|
|
if: ${{ inputs.publish && (inputs.branch == 'releases/beta' || inputs.latest) }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} # Need the custom user token here so we can approve and merge the PR
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
gh pr review ${{ steps.pr.outputs.url }} --approve
|
|
|
|
gh pr merge ${{ steps.pr.outputs.url }} --delete-branch --admin --squash
|
|
|
|
|
|
|
|
- name: Delete the release branch
|
|
|
|
if: ${{ inputs.publish }}
|
2023-12-12 12:45:17 +00:00
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
git push origin --delete ${{ inputs.branch }} || true
|
|
|
|
git push origin --delete releases/stable || true
|