Rename the next workflow to alpha (#4175)
This commit is contained in:
parent
3539eac25d
commit
e57a7dbfa0
4 changed files with 122 additions and 70 deletions
43
.github/workflows/alpha.yml
vendored
Normal file
43
.github/workflows/alpha.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# This workflow triggers alpha releases
|
||||
|
||||
name: Alpha release
|
||||
|
||||
run-name: "Alpha release '${{ inputs.git-ref }}' (version: 2.0.0-alpha.${{ inputs.patch }}, publish: ${{ inputs.publish || github.event_name == 'schedule' }})"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
git-ref:
|
||||
required: true
|
||||
type: string
|
||||
description: "The github ref of this alpha version (i.e. main, 1234567)"
|
||||
default: main
|
||||
patch:
|
||||
required: true
|
||||
type: string
|
||||
description: "The patch of this alpha version (i.e. 1, 2)"
|
||||
publish:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Publish the alpha release"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Prepare alpha release
|
||||
uses: ./.github/workflows/reusable_publish_version.yml
|
||||
with:
|
||||
environment: alpha
|
||||
extra-features: storage-surrealkv
|
||||
git-ref: ${{ inputs.git-ref }}
|
||||
patch: ${{ inputs.patch }}
|
||||
publish: ${{ inputs.publish }}
|
||||
create-release: ${{ inputs.publish }}
|
||||
secrets: inherit
|
39
.github/workflows/next.yml
vendored
39
.github/workflows/next.yml
vendored
|
@ -1,39 +0,0 @@
|
|||
# This workflow triggers next releases
|
||||
|
||||
name: Next release
|
||||
|
||||
run-name: "Next release '${{ inputs.git-ref || github.ref_name }}' (publish: ${{ inputs.publish || github.event_name == 'schedule' }})"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
git-ref:
|
||||
required: true
|
||||
type: string
|
||||
description: "The github ref of this next version (i.e. main, 1234567)"
|
||||
default: main
|
||||
publish:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Publish the next release"
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Prepare next release
|
||||
uses: ./.github/workflows/reusable_publish_version.yml
|
||||
with:
|
||||
environment: next
|
||||
extra-features: storage-surrealkv
|
||||
git-ref: ${{ inputs.git-ref || github.ref_name }}
|
||||
publish: ${{ inputs.publish || github.event_name == 'schedule' }}
|
||||
secrets: inherit
|
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
|
@ -29,6 +29,6 @@ jobs:
|
|||
with:
|
||||
environment: nightly
|
||||
extra-features: storage-surrealkv
|
||||
git-ref: 1.x
|
||||
git-ref: main
|
||||
publish: ${{ inputs.publish || github.event_name == 'schedule' }}
|
||||
secrets: inherit
|
||||
|
|
108
.github/workflows/reusable_publish_version.yml
vendored
108
.github/workflows/reusable_publish_version.yml
vendored
|
@ -4,11 +4,16 @@ on:
|
|||
environment:
|
||||
required: true
|
||||
type: string
|
||||
description: "The name of this release environment. It can be 'next', 'nightly', 'beta' or 'stable'"
|
||||
description: "The name of this release environment. It can be 'nightly', 'alpha', 'beta' or 'stable'"
|
||||
git-ref:
|
||||
required: true
|
||||
type: string
|
||||
description: "The git ref of this release version. All 'actions/checkout' steps will use it"
|
||||
patch:
|
||||
required: false
|
||||
type: string
|
||||
default: "1"
|
||||
description: "The patch release of this alpha release"
|
||||
bump-version:
|
||||
required: false
|
||||
type: boolean
|
||||
|
@ -169,12 +174,23 @@ jobs:
|
|||
# Create the tag
|
||||
git tag -a v${betaVersion} -m "Release ${betaVersion}" || true
|
||||
|
||||
- name: Create or patch alpha branch
|
||||
if: ${{ inputs.environment == 'alpha' }}
|
||||
run: |
|
||||
set -x
|
||||
|
||||
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
||||
|
||||
# Create the tag
|
||||
alphaVersion=${currentVersion}-${{ inputs.environment }}.${{ inputs.patch }}
|
||||
git tag -a v${alphaVersion} -m "Release ${alphaVersion}" || true
|
||||
|
||||
- name: Push changes
|
||||
if: ${{ inputs.publish && (inputs.environment == 'beta' || inputs.environment == 'stable') }}
|
||||
run: git push
|
||||
|
||||
- name: Push tag
|
||||
if: ${{ inputs.publish && (inputs.environment == 'beta' || inputs.environment == 'stable') }}
|
||||
if: ${{ inputs.publish && (inputs.environment == 'alpha' || inputs.environment == 'beta' || inputs.environment == 'stable') }}
|
||||
run: git push --tags || true
|
||||
|
||||
- name: Set outputs
|
||||
|
@ -184,13 +200,17 @@ jobs:
|
|||
|
||||
version=$(taplo get -f Cargo.toml "package.version")
|
||||
|
||||
if [[ "${{ inputs.publish }}" == "true" && ("${{ inputs.environment }}" == "beta" || "${{ inputs.environment }}" == "stable") ]]; then
|
||||
if [[ "${{ inputs.environment }}" == "alpha" ]]; then
|
||||
version=${version}-${{ inputs.environment }}.${{ inputs.patch }}
|
||||
fi
|
||||
|
||||
if [[ "${{ inputs.publish }}" == "true" && ("${{ inputs.environment }}" == "alpha" || "${{ inputs.environment }}" == "beta" || "${{ inputs.environment }}" == "stable") ]]; then
|
||||
echo "git-ref=v${version}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "git-ref=${{ inputs.git-ref }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
if [[ "${{ inputs.environment }}" == "nightly" || "${{ inputs.environment }}" == "next" ]]; then
|
||||
if [[ "${{ inputs.environment }}" == "nightly" ]]; then
|
||||
echo "name=${{ inputs.environment }}" >> $GITHUB_OUTPUT
|
||||
|
||||
date=$(git show --no-patch --format=%ad --date=format:%Y%m%d)
|
||||
|
@ -499,6 +519,9 @@ jobs:
|
|||
with:
|
||||
ref: ${{ needs.prepare-vars.outputs.git-ref }}
|
||||
|
||||
- name: Create a temporary branch
|
||||
run: git checkout -b binary
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
|
@ -524,6 +547,39 @@ jobs:
|
|||
set +e
|
||||
go version ; cargo version ; rustc --version ; cmake --version ; gcc --version ; g++ --version ; perl -v
|
||||
|
||||
- name: Patch alpha crate version
|
||||
if: ${{ inputs.environment == 'alpha' }}
|
||||
run: |
|
||||
set -x
|
||||
|
||||
version=2.0.0-${{ inputs.environment }}.${{ inputs.patch }}
|
||||
|
||||
if [[ "${{ matrix.arch }}" == *apple-darwin ]]; then
|
||||
brew install gnu-sed
|
||||
|
||||
if [[ "${{ matrix.arch }}" == "aarch64-apple-darwin" ]]; then
|
||||
export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
|
||||
else
|
||||
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update the version to a nightly one
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" Cargo.toml
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" core/Cargo.toml
|
||||
sed -i "s#surrealdb = { version = \"2\"#surrealdb = { version = \"=${version}\"#" Cargo.toml
|
||||
sed -i "s#surrealdb-core = { version = \"2\"#surrealdb-core = { version = \"=${version}\"#" lib/Cargo.toml
|
||||
|
||||
# Update Cargo.lock without updating dependency versions
|
||||
cargo check --no-default-features --features storage-mem
|
||||
|
||||
# Temporarily commit patches
|
||||
# These should not be pushed back to the repo
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "github-actions[bot]"
|
||||
git commit -am "Version patches"
|
||||
|
||||
- name: Build step
|
||||
env:
|
||||
SURREAL_BUILD_METADATA: ${{ needs.prepare-vars.outputs.build-metadata }}
|
||||
|
@ -598,6 +654,18 @@ jobs:
|
|||
sed -i "s#^version = \".*\"#version = \"2.0.0-${version}\"#" core/Cargo.toml
|
||||
sed -i "s#surrealdb-core2 = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core2 = { version = \"=2.0.0-${version}\"#" lib/Cargo.toml
|
||||
|
||||
- name: Patch alpha crate version
|
||||
if: ${{ inputs.environment == 'alpha' }}
|
||||
run: |
|
||||
set -x
|
||||
|
||||
version=2.0.$((${{ inputs.patch }} - 1))
|
||||
|
||||
# Update the version to a nightly one
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" core/Cargo.toml
|
||||
sed -i "s#surrealdb-core = { version = \"2\"#surrealdb-core = { version = \"=${version}\"#" lib/Cargo.toml
|
||||
|
||||
- name: Patch nightly crate version
|
||||
if: ${{ inputs.environment == 'nightly' }}
|
||||
run: |
|
||||
|
@ -610,30 +678,10 @@ jobs:
|
|||
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
||||
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
||||
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
||||
# This sets the nightly and next version to something like `1.3.20231117`
|
||||
# This sets the nightly version to something like `1.3.20231117`
|
||||
version=${major}.${minor}.${date}
|
||||
|
||||
# Update the version to a nightly or next one
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
||||
sed -i "s#^version = \".*\"#version = \"2.0.0-${version}\"#" core/Cargo.toml
|
||||
sed -i "s#surrealdb-core2 = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core2 = { version = \"=2.0.0-${version}\"#" lib/Cargo.toml
|
||||
|
||||
- name: Patch next crate version
|
||||
if: ${{ inputs.environment == 'next' }}
|
||||
run: |
|
||||
set -x
|
||||
|
||||
# Get the date of the last commit
|
||||
date=$(git show --no-patch --format=%ad --date=format:%Y%m%d)
|
||||
|
||||
# Derive crate version
|
||||
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
||||
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
||||
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
||||
# This sets the nightly and next version to something like `1.3.20231117`
|
||||
version=${major}.${minor}.${date}
|
||||
|
||||
# Update the version to a nightly or next one
|
||||
# Update the version to a nightly one
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
||||
sed -i "s#^version = \".*\"#version = \"${version}\"#" core/Cargo.toml
|
||||
sed -i "s#surrealdb-core = { version = \"${major}\"#surrealdb-core = { version = \"=${version}\"#" lib/Cargo.toml
|
||||
|
@ -696,11 +744,11 @@ jobs:
|
|||
echo ${{ needs.prepare-vars.outputs.git-ref }} > latest.txt
|
||||
aws s3 cp --cache-control 'no-store' latest.txt s3://download.surrealdb.com/latest.txt
|
||||
|
||||
- name: Set latest beta version
|
||||
if: ${{ inputs.publish && inputs.environment == 'beta' }}
|
||||
- name: Set latest alpha or beta version
|
||||
if: ${{ inputs.publish && (inputs.environment == 'alpha' || inputs.environment == 'beta') }}
|
||||
run: |
|
||||
echo ${{ needs.prepare-vars.outputs.git-ref }} > beta.txt
|
||||
aws s3 cp --cache-control 'no-store' beta.txt s3://download.surrealdb.com/beta.txt
|
||||
echo ${{ needs.prepare-vars.outputs.git-ref }} > ${{ inputs.environment }}.txt
|
||||
aws s3 cp --cache-control 'no-store' ${{ inputs.environment }}.txt s3://download.surrealdb.com/${{ inputs.environment }}.txt
|
||||
|
||||
- name: Publish binaries
|
||||
run: |
|
||||
|
|
Loading…
Reference in a new issue