-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DO-2216 / Propose an automated release workflow #1805
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bed5e2c
add release workflows
kofrdx 5a2a4b7
add release workflow
kofrdx d64e426
clean up
kofrdx d84414b
update update script
kofrdx 49a1aa9
update cli dependencies also
kofrdx 3de9013
fix cargo update version script
kofrdx e4636e8
update all occurances of 1.2.0-dev
kofrdx a1a1cba
slight fix on version update file
kofrdx e78ed7b
ommit target folder
kofrdx 2252a04
only update necessary files
kofrdx efdfc14
let cargo lock update be executed by corresponding script
kofrdx b267401
clean up comments
kofrdx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* @radixdlt/devops | ||
* @radixdlt/radix |
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
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 }} |
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
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 }} |
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
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 |
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
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't fully understand how matrics work, but we need to publish the crates sequentially in this order. |
||
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 }} |
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
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/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" "./scrypto-test/tests/blueprints/tuple-return/Cargo.toml" "./scrypto-compiler/tests/assets/scenario_1/blueprint/Cargo.toml" "./scrypto-compiler/tests/assets/scenario_1/blueprint_2/Cargo.toml" "./scrypto-compiler/tests/assets/scenario_1/blueprint_4/Cargo.toml" "./scrypto-compiler/tests/assets/scenario_1/dir/blueprint_3/Cargo.toml" ) | ||
RADIX_CARGO_FILES=$(find . -iname Cargo.toml -mindepth 2 -not -path "./target/*") | ||
RADIX_CARGO_LOCK_FILES=$(find . -iname Cargo.lock -mindepth 2 -not -path "./target/*") | ||
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 | ||
|
||
echo "Update the package.version in all radix owned Cargo.lock files" | ||
for toml_lock_file in ${RADIX_CARGO_LOCK_FILES[@]}; do | ||
NUMBER_OF_PACKAGES_IN_LOCKFILE=$(toml get $toml_lock_file package | jq length) | ||
|
||
echo "Update the package.version of all radix owned projects in $toml_lock_file file" | ||
for (( i=0; i<$NUMBER_OF_PACKAGES_IN_LOCKFILE; i++ )) | ||
do | ||
value=$(toml get $toml_lock_file "package[$i].name" -r); | ||
if [[ "${INTERNAL_PROJECT_LIST[@]}" =~ $value && $value != "toml" ]]; then | ||
toml set "$toml_lock_file" "package[$i].version" "${VERSION}" > "$toml_lock_file.new" | ||
mv $toml_lock_file.new $toml_lock_file | ||
fi; | ||
done | ||
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 | ||
|
||
toml set scrypto-test/assets/blueprints/Cargo.lock package.test_environment.version "${VERSION}" > scrypto-test/assets/blueprints/Cargo.lock.new | ||
mv scrypto-test/assets/blueprints/Cargo.lock.new scrypto-test/assets/blueprints/Cargo.lock | ||
|
||
toml set examples/everything/Cargo.toml_for_scrypto_builder package.version "${VERSION}" > examples/everything/Cargo.toml_for_scrypto_builder.new | ||
mv examples/everything/Cargo.toml_for_scrypto_builder.new examples/everything/Cargo.toml_for_scrypto_builder | ||
|
||
./update-cargo-locks.sh | ||
|
||
echo "Done" | ||
kofrdx marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the codeowners change for now? We have a separate task to change that for the whole code base.