Skip to content

Commit

Permalink
Merge b267401 into 82e4428
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Fehrs authored May 23, 2024
2 parents 82e4428 + b267401 commit f5d012c
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @radixdlt/devops
* @radixdlt/radix
48 changes: 48 additions & 0 deletions .github/workflows/dispatch-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Dispatch release
on:
workflow_dispatch:
inputs:
release-tag:
type: string
description: release-tag

permissions: write-all

jobs:
dispatch-release:
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- name: create pull request
run: gh pr create -B ${BASE_BRANCH} -H ${CURRENT_BRANCH} --title 'Merge release into main' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_BRANCH: main
CURRENT_BRANCH: ${{ github.ref_name }}
continue-on-error: true
- name: Update Version
run: |
if [[ $VERSION_NUMBER =~ ^v[0-9]+\.[0-9]+ ]]; then
echo "Tag ${VERSION_NUMBER}"
echo "Cargo Version ${VERSION_NUMBER:1}"
else
echo "Something is wrong with your version" >&2
echo "Make sure your version is in semantic versioning format and starts with a v" >&2
exit -1
fi
./update-cargo-toml-versions.sh ${VERSION_NUMBER:1}
git config --global user.name 'Radix Bot'
git config --global user.email 'radixbot@rdx.works'
git add .
git commit -m "Update version to ${VERSION_NUMBER:1}"
echo "Testing to release all updated cargo crates"
./test-cargo-crates-release.sh
git push
# gh release create ${VERSION_NUMBER} --notes "Release from dispatch" --prerelease
git tag ${VERSION_NUMBER}
git push --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_NUMBER: ${{ inputs.release-tag }}
35 changes: 35 additions & 0 deletions .github/workflows/dispatch-update-development-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Dispatch Update Development Version
on:
workflow_dispatch:
inputs:
development-tag:
type: string
description: development-tag

permissions: write-all

jobs:
update-version:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
steps:
- uses: RDXWorks-actions/checkout@main
- name: Update Version
run: |
if [[ $VERSION_NUMBER =~ ^v[0-9]+\.[0-9]\.[0-9]+-dev ]]; then
echo "Tag ${VERSION_NUMBER}"
echo "Cargo Version ${VERSION_NUMBER:1}"
else
echo "Something is wrong with your version" >&2
echo "Make sure your version is in semantic versioning format and starts with a v and ends in -dev" >&2
exit -1
fi
./update-cargo-toml-versions.sh ${VERSION_NUMBER:1}
git config --global user.name 'Radix Bot'
git config --global user.email 'radixbot@rdx.works'
git add .
git commit -m "Update version to ${VERSION_NUMBER:1}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_NUMBER: ${{ inputs.development-tag }}
20 changes: 20 additions & 0 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Merge main into develop
on:
push:
branches:
- main

permissions: write-all

jobs:
create-pr-main-into-develop:
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- name: create pull request
run: gh pr create -B ${BASE_BRANCH} -H ${CURRENT_BRANCH} --title 'Merge main into develop' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_BRANCH: develop
CURRENT_BRANCH: main
continue-on-error: true
65 changes: 65 additions & 0 deletions .github/workflows/publish-cargo-crates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish cargo crates

on:
release:
types:
- released
- prereleased

permissions:
packages: write
pull-requests: write
id-token: write
contents: read

jobs:
publish-crates:
strategy:
matrix:
include:
- toml_file: "./scrypto-derive/Cargo.toml"
- toml_file: "./radix-substate-store-queries/Cargo.toml"
- toml_file: "./radix-common-derive/Cargo.toml"
- toml_file: "./radix-engine-profiling/Cargo.toml"
- toml_file: "./radix-substate-store-impls/Cargo.toml"
- toml_file: "./radix-clis/Cargo.toml"
- toml_file: "./radix-sbor-derive/Cargo.toml"
- toml_file: "./sbor-derive/Cargo.toml"
- toml_file: "./scrypto/Cargo.toml"
- toml_file: "./scrypto-test/Cargo.toml"
- toml_file: "./radix-transactions/Cargo.toml"
- toml_file: "./radix-native-sdk/Cargo.toml"
- toml_file: "./radix-blueprint-schema-init/Cargo.toml"
- toml_file: "./scrypto-compiler/Cargo.toml"
- toml_file: "./sbor-tests/Cargo.toml"
- toml_file: "./radix-engine-interface/Cargo.toml"
- toml_file: "./radix-rust/Cargo.toml"
- toml_file: "./sbor-derive-common/Cargo.toml"
- toml_file: "./radix-engine-profiling-derive/Cargo.toml"
- toml_file: "./radix-common/Cargo.toml"
- toml_file: "./sbor/Cargo.toml"
- toml_file: "./scrypto-derive-tests/Cargo.toml"
- toml_file: "./radix-engine/Cargo.toml"
- toml_file: "./radix-transaction-scenarios/Cargo.toml"
- toml_file: "./radix-engine-monkey-tests/Cargo.toml"
- toml_file: "./radix-engine-tests/Cargo.toml"
- toml_file: "./radix-substate-store-interface/Cargo.toml"
runs-on: ubuntu-latest
steps:
- uses: RDXWorks-actions/checkout@main
- uses: radixdlt/iac-resuable-artifacts/fetch-secrets@v0.8.0
with:
role_name: "arn:aws:iam::308190735829:role/gh-common-secrets-read-access"
app_name: "radixdlt-scrypto"
step_name: "publish-crate"
secret_prefix: "CRATES"
secret_name: "arn:aws:secretsmanager:eu-west-2:308190735829:secret:github-actions/common/cratesio-token-IjOP4n"
parse_json: true
- name: Dry Run Publish crates
if: github.event.release.prerelease
run: |
cargo publish --dry-run --token "${{ env.CRATES_TOKEN }}" --manifest-path ${{ matrix.toml_file }}
- name: Publish crates
if: github.event.release.prerelease == false
run: |
cargo publish --token "${{ env.CRATES_TOKEN }}" --manifest-path ${{ matrix.toml_file }}
12 changes: 12 additions & 0 deletions test-cargo-crates-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
set -u

echo "Publishing all cargo crates"
CARGO_FILES=("./scrypto-derive/Cargo.toml" "./radix-substate-store-queries/Cargo.toml" "./radix-common-derive/Cargo.toml" "./radix-engine-profiling/Cargo.toml" "./radix-substate-store-impls/Cargo.toml" "./radix-clis/Cargo.toml" "./radix-sbor-derive/Cargo.toml" "./sbor-derive/Cargo.toml" "./scrypto/Cargo.toml" "./scrypto-test/Cargo.toml" "./radix-transactions/Cargo.toml" "./radix-native-sdk/Cargo.toml" "./radix-blueprint-schema-init/Cargo.toml" "./scrypto-compiler/Cargo.toml" "./sbor-tests/Cargo.toml" "./radix-engine-interface/Cargo.toml" "./radix-rust/Cargo.toml" "./sbor-derive-common/Cargo.toml" "./radix-engine-profiling-derive/Cargo.toml" "./radix-common/Cargo.toml" "./sbor/Cargo.toml" "./scrypto-derive-tests/Cargo.toml" "./radix-engine/Cargo.toml" "./radix-transaction-scenarios/Cargo.toml" "./radix-engine-monkey-tests/Cargo.toml" "./radix-engine-tests/Cargo.toml" "./radix-substate-store-interface/Cargo.toml")
for toml_file_dir in ${CARGO_FILES[@]}; do
echo "Publishing crate in directory ${toml_file_dir}"
echo "cargo publish --dry-run --token "${CRATES_TOKEN}" --manifest-path ${toml_file_dir}"
cargo publish --dry-run --token "${CRATES_TOKEN}" --manifest-path ${toml_file_dir}
cargo package --list --manifest-path "${toml_file_dir}"
done
54 changes: 54 additions & 0 deletions update-cargo-toml-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -u
set -e
export VERSION=$1

echo "Updating to version ${VERSION}"
cargo install toml-cli

RADIX_CARGO_FILES=("./scrypto-derive/Cargo.toml" "./radix-substate-store-queries/Cargo.toml" "./radix-common-derive/Cargo.toml" "./radix-engine-profiling/Cargo.toml" "./radix-substate-store-impls/Cargo.toml" "./radix-clis/Cargo.toml" "./radix-sbor-derive/Cargo.toml" "./sbor-derive/Cargo.toml" "./scrypto/Cargo.toml" "./scrypto-test/Cargo.toml" "./radix-transactions/Cargo.toml" "./radix-native-sdk/Cargo.toml" "./radix-blueprint-schema-init/Cargo.toml" "./scrypto-compiler/Cargo.toml" "./sbor-tests/Cargo.toml" "./radix-engine-interface/Cargo.toml" "./radix-rust/Cargo.toml" "./sbor-derive-common/Cargo.toml" "./radix-engine-profiling-derive/Cargo.toml" "./radix-common/Cargo.toml" "./sbor/Cargo.toml" "./scrypto-derive-tests/Cargo.toml" "./radix-engine/Cargo.toml" "./radix-transaction-scenarios/Cargo.toml" "./radix-engine-monkey-tests/Cargo.toml" "./radix-engine-tests/Cargo.toml" "./radix-substate-store-interface/Cargo.toml" )
INTERNAL_PROJECT_LIST=("radix-blueprint-schema-init" "radix-common" "radix-common-derive" "radix-engine" "radix-engine-interface" "radix-engine-profiling" "radix-engine-profiling-derive" "radix-native-sdk" "radix-rust" "radix-sbor-derive" "radix-substate-store-impls" "radix-substate-store-interface" "radix-substate-store-queries" "radix-transaction-scenarios" "radix-transactions" "sbor" "sbor-derive" "sbor-derive-common" "scrypto" "scrypto-compiler" "scrypto-derive" "scrypto-test")

NUMBER_OF_PROJECTS=${#INTERNAL_PROJECT_LIST[@]}

echo "Update workspace dependencies in Cargo.toml"
for (( i=0; i<$NUMBER_OF_PROJECTS; i++ ))
do
set +e
value=$(toml get Cargo.toml "workspace.dependencies.${INTERNAL_PROJECT_LIST[$i]}" -r);
ret=$?
set -e
if [ $ret -eq 0 ]; then
echo "Updating ${INTERNAL_PROJECT_LIST[$i]} from $value to ${VERSION}"
toml set Cargo.toml "workspace.dependencies.${INTERNAL_PROJECT_LIST[$i]}.version" "${VERSION}" > Cargo.toml.new
mv Cargo.toml.new Cargo.toml
fi
done

echo "Update the package.version in all radix owned Cargo.toml files"
for toml_file in ${RADIX_CARGO_FILES[@]}; do
FILENAME=${toml_file}
echo "Updating ${toml_file} from $(toml get "${FILENAME}" package.version) to \"${VERSION}\""
toml set "${FILENAME}" package.version "${VERSION}" > "${FILENAME}.new"
mv "${FILENAME}.new" "${FILENAME}"
done

for toml_file in ${RADIX_CARGO_FILES[@]}; do
echo "Update dependencies of $toml_file"
for (( i=0; i<$NUMBER_OF_PROJECTS; i++ ))
do
set +e
value=$(toml get $toml_file "dependencies.${INTERNAL_PROJECT_LIST[$i]}" -r);
ret=$?
set -e
if [ $ret -eq 0 ]; then
echo "Setting ${INTERNAL_PROJECT_LIST[$i]} version dependency from $value to ${VERSION}"
toml set $toml_file "dependencies.${INTERNAL_PROJECT_LIST[$i]}.version" "${VERSION}" > $toml_file.new
mv $toml_file.new $toml_file
fi
done
done

./update-cargo-locks.sh

echo "Done"

0 comments on commit f5d012c

Please sign in to comment.