Improve issue templates (#5454) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this workflow to trigger beta releases, both initial beta.1 and subsequent beta.x releases | ||
name: Beta release | ||
run-name: "Beta release (publish: ${{ inputs.publish }}, bump version: ${{ inputs.bump-version }})" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
publish: | ||
required: false | ||
type: boolean | ||
default: false | ||
description: "Publish the beta release" | ||
bump-version: | ||
required: false | ||
type: boolean | ||
default: false | ||
description: "Bump the version of the current beta if this is not the initial one" | ||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
contents: write | ||
jobs: | ||
checks: | ||
name: Pre-release checks | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branch: ${{ steps.outputs.outputs.branch }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Determine the correct branch | ||
id: outputs | ||
run: | | ||
set -x | ||
if git branch -r | grep -w 'releases/beta'; then | ||
echo "branch=releases/beta" >> $GITHUB_OUTPUT | ||
else | ||
echo "branch=1.x" >> $GITHUB_OUTPUT | ||
fi | ||
release: | ||
name: Prepare beta release | ||
needs: [checks] | ||
uses: ./.github/reusable/publish-version.yml | ||
with: | ||
environment: beta | ||
git-ref: ${{ needs.checks.outputs.branch }} | ||
bump-version: ${{ inputs.bump-version }} | ||
publish: ${{ inputs.publish }} | ||
create-release: ${{ inputs.publish }} | ||
secrets: inherit | ||
bump-version: | ||
name: Bump 1.x version | ||
if: ${{ inputs.publish }} | ||
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 | ||
- name: Install a TOML parser | ||
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 | ||
- name: Get version info | ||
id: bump | ||
run: | | ||
set -x | ||
# Retrieve just released version | ||
betaVersion=$(taplo get -f Cargo.toml "package.version") | ||
major=$(echo $betaVersion | tr "." "\n" | sed -n 1p) | ||
minor=$(echo $betaVersion | tr "." "\n" | sed -n 2p) | ||
betaNum=$(echo $betaVersion | tr "." "\n" | sed -n 4p) | ||
nightlyVersion=${major}.$(($minor + 1)).0 | ||
echo "version=${nightlyVersion}" >> $GITHUB_OUTPUT | ||
echo "beta-num=${betaNum}" >> $GITHUB_OUTPUT | ||
- name: Create version bump branch | ||
if: ${{ steps.bump.outputs.beta-num == '1' }} | ||
env: | ||
RUSTFLAGS: "--cfg surrealdb_unstable" | ||
run: | | ||
set -x | ||
# Checkout the 1.x branch | ||
git fetch origin 1.x | ||
git checkout 1.x | ||
# Switch to version bump branch | ||
git checkout -b version-bump/v${{ steps.bump.outputs.version }} | ||
# Bump the crate version | ||
sed -i "s#^version = \".*\"#version = \"${{ steps.bump.outputs.version }}\"#" Cargo.toml | ||
sed -i "s#^version = \".*\"#version = \"${{ steps.bump.outputs.version }}\"#" crates/sdk/Cargo.toml | ||
sed -i "s#^version = \".*\"#version = \"2.1.0-${{ steps.bump.outputs.version }}\"#" crates/core/Cargo.toml | ||
# Update dependency versions | ||
sed -i "s#surrealdb-core2 = { version = \".*\", default-features#surrealdb-core2 = { version = \"=2.1.0-${{ steps.bump.outputs.version }}\", default-features#" crates/sdk/Cargo.toml | ||
# Update Cargo.lock without updating dependency versions | ||
cargo check --no-default-features --features storage-mem | ||
- name: Push the branch | ||
if: ${{ steps.bump.outputs.beta-num == '1' }} | ||
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 | ||
if: ${{ steps.bump.outputs.beta-num == '1' }} | ||
id: pr | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} | ||
run: | | ||
set -x | ||
url=$(gh pr create --base 1.x --title "Bump version to v${{ steps.bump.outputs.version }}" --body "Update 1.x version") | ||
echo "url=${url}" >> $GITHUB_OUTPUT | ||
- name: Merge the PR | ||
if: ${{ steps.bump.outputs.beta-num == '1' }} | ||
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 |