2023-12-11 13:58:43 +00:00
|
|
|
# Use this workflow to trigger beta releases, both initial beta.1 and subsequent beta.x releases
|
|
|
|
|
2023-12-06 14:46:23 +00:00
|
|
|
name: Beta release
|
|
|
|
|
2023-12-12 12:45:17 +00:00
|
|
|
run-name: "Beta release (publish: ${{ inputs.publish }}, bump version: ${{ inputs.bump-version }})"
|
2023-12-06 14:46:23 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
publish:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Publish the beta release"
|
2023-12-12 12:45:17 +00:00
|
|
|
bump-version:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Bump the version of the current beta if this is not the initial one"
|
2023-12-06 14:46:23 +00:00
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2023-12-11 13:58:43 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
2023-12-06 14:46:23 +00:00
|
|
|
jobs:
|
2023-12-11 13:58:43 +00:00
|
|
|
checks:
|
|
|
|
name: Pre-release checks
|
2023-12-06 14:46:23 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-12-11 13:58:43 +00:00
|
|
|
outputs:
|
|
|
|
branch: ${{ steps.outputs.outputs.branch }}
|
2023-12-06 14:46:23 +00:00
|
|
|
steps:
|
2023-12-11 13:58:43 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-06 14:46:23 +00:00
|
|
|
with:
|
2023-12-11 13:58:43 +00:00
|
|
|
fetch-depth: 0
|
2023-12-06 14:46:23 +00:00
|
|
|
|
2023-12-11 13:58:43 +00:00
|
|
|
- name: Determine the correct branch
|
|
|
|
id: outputs
|
2023-12-06 14:46:23 +00:00
|
|
|
run: |
|
|
|
|
set -x
|
2023-12-11 13:58:43 +00:00
|
|
|
if git branch -r | grep -w 'releases/beta'; then
|
|
|
|
echo "branch=releases/beta" >> $GITHUB_OUTPUT
|
|
|
|
else
|
2024-04-17 18:58:44 +00:00
|
|
|
echo "branch=1.x" >> $GITHUB_OUTPUT
|
2023-12-11 13:58:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
release:
|
|
|
|
name: Prepare beta release
|
|
|
|
needs: [checks]
|
|
|
|
uses: ./.github/workflows/reusable_publish_version.yml
|
|
|
|
with:
|
|
|
|
environment: beta
|
|
|
|
git-ref: ${{ needs.checks.outputs.branch }}
|
2023-12-12 12:45:17 +00:00
|
|
|
bump-version: ${{ inputs.bump-version }}
|
2023-12-11 13:58:43 +00:00
|
|
|
publish: ${{ inputs.publish }}
|
|
|
|
create-release: ${{ inputs.publish }}
|
|
|
|
secrets: inherit
|
2024-02-05 12:01:39 +00:00
|
|
|
|
|
|
|
bump-version:
|
2024-04-17 18:58:44 +00:00
|
|
|
name: Bump 1.x version
|
2024-02-06 08:41:27 +00:00
|
|
|
if: ${{ inputs.publish }}
|
2024-02-05 12:01:39 +00:00
|
|
|
needs: [checks, release]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: releases/beta
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
|
|
|
|
- name: Install a TOML parser
|
2024-02-06 08:41:27 +00:00
|
|
|
run: |
|
|
|
|
curl -L https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-full-linux-x86_64.gz | gunzip - > taplo
|
|
|
|
chmod +x taplo
|
|
|
|
sudo mv taplo /usr/bin/taplo
|
2024-02-05 12:01:39 +00:00
|
|
|
|
2024-02-06 08:41:27 +00:00
|
|
|
- name: Get version info
|
2024-02-05 12:01:39 +00:00
|
|
|
id: bump
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Retrieve just released version
|
2024-02-19 15:38:13 +00:00
|
|
|
betaVersion=$(taplo get -f Cargo.toml "package.version")
|
2024-02-05 12:01:39 +00:00
|
|
|
major=$(echo $betaVersion | tr "." "\n" | sed -n 1p)
|
|
|
|
minor=$(echo $betaVersion | tr "." "\n" | sed -n 2p)
|
2024-02-06 08:41:27 +00:00
|
|
|
betaNum=$(echo $betaVersion | tr "." "\n" | sed -n 4p)
|
2024-02-05 12:01:39 +00:00
|
|
|
nightlyVersion=${major}.$(($minor + 1)).0
|
|
|
|
echo "version=${nightlyVersion}" >> $GITHUB_OUTPUT
|
2024-02-06 08:41:27 +00:00
|
|
|
echo "beta-num=${betaNum}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Create version bump branch
|
|
|
|
if: ${{ steps.bump.outputs.beta-num == '1' }}
|
2024-03-21 08:26:30 +00:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: "--cfg surrealdb_unstable"
|
2024-02-06 08:41:27 +00:00
|
|
|
run: |
|
|
|
|
set -x
|
2024-02-05 12:01:39 +00:00
|
|
|
|
2024-04-17 18:58:44 +00:00
|
|
|
# Checkout the 1.x branch
|
|
|
|
git fetch origin 1.x
|
|
|
|
git checkout 1.x
|
2024-02-05 12:01:39 +00:00
|
|
|
|
|
|
|
# Switch to version bump branch
|
2024-02-06 08:41:27 +00:00
|
|
|
git checkout -b version-bump/v${{ steps.bump.outputs.version }}
|
2024-02-05 12:01:39 +00:00
|
|
|
|
|
|
|
# Bump the crate version
|
2024-02-06 08:41:27 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"${{ steps.bump.outputs.version }}\"#" Cargo.toml
|
2024-08-23 11:52:14 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"${{ steps.bump.outputs.version }}\"#" sdk/Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"2.0.0-${{ steps.bump.outputs.version }}\"#" core/Cargo.toml
|
|
|
|
|
|
|
|
# Update dependency versions
|
2024-08-23 11:52:14 +00:00
|
|
|
sed -i "s#surrealdb-core2 = { version = \".*\", default-features#surrealdb-core2 = { version = \"=2.0.0-${{ steps.bump.outputs.version }}\", default-features#" sdk/Cargo.toml
|
2024-02-05 12:01:39 +00:00
|
|
|
|
|
|
|
# Update Cargo.lock without updating dependency versions
|
|
|
|
cargo check --no-default-features --features storage-mem
|
|
|
|
|
|
|
|
- name: Push the branch
|
2024-02-06 08:41:27 +00:00
|
|
|
if: ${{ steps.bump.outputs.beta-num == '1' }}
|
2024-02-05 12:01:39 +00:00
|
|
|
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
|
2024-02-06 08:41:27 +00:00
|
|
|
if: ${{ steps.bump.outputs.beta-num == '1' }}
|
2024-02-05 12:01:39 +00:00
|
|
|
id: pr
|
|
|
|
env:
|
2024-03-15 16:58:51 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
|
2024-02-05 12:01:39 +00:00
|
|
|
run: |
|
|
|
|
set -x
|
2024-04-17 18:58:44 +00:00
|
|
|
url=$(gh pr create --base 1.x --title "Bump version to v${{ steps.bump.outputs.version }}" --body "Update 1.x version")
|
2024-02-05 12:01:39 +00:00
|
|
|
echo "url=${url}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Merge the PR
|
2024-02-06 08:41:27 +00:00
|
|
|
if: ${{ steps.bump.outputs.beta-num == '1' }}
|
2024-02-05 12:01:39 +00:00
|
|
|
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 merge ${{ steps.pr.outputs.url }} --delete-branch --admin --squash
|