release #36
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
name: release | |
# generating package artefacts from the main branch | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'The tag to upload this asset into' | |
required: true | |
default: 'algo_templates' | |
jobs: | |
packaging-algo: | |
if: github.repository == 'Project-MONAI/research-contributions' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Algo name | |
id: name | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build ${{ steps.name.outputs.sha_short }} | |
env: | |
release_version: ${{ steps.name.outputs.sha_short }} | |
run: | | |
echo $release_version | |
cd auto3dseg/ | |
tar -cvzf "$release_version".tar.gz algorithm_templates | |
- name: Upload ${{ steps.name.outputs.sha_short }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
tag: ${{ github.event.inputs.tag_name }} | |
file: auto3dseg/${{ steps.name.outputs.sha_short }}.tar.gz | |
asset_name: ${{ steps.name.outputs.sha_short }}.tar.gz | |
overwrite: false | |
- name: Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.name.outputs.sha_short }} | |
path: auto3dseg/${{ steps.name.outputs.sha_short }}.tar.gz | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PR_MAINTAIN_BOT }} | |
repository: Project-MONAI/MONAI | |
ref: dev | |
path: monai_src_dir | |
- name: Modify MONAI core source code | |
id: hash_code | |
run: | | |
cd monai_src_dir | |
git config --global user.name 'monai-bot' | |
git config --global user.email '[email protected]' | |
# modify hash | |
filename="monai/utils/misc.py" | |
current_hash=$(grep -oE "[0-9a-f]{7}" $filename) | |
sed -i s/$current_hash/${{ steps.name.outputs.sha_short }}/ $filename | |
git add . | |
git diff --cached | cat | |
changes= | |
if [ -n "$(git status --porcelain)" ]; then | |
changes="true" | |
fi | |
echo "format=$changes" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: make a PR | |
if: steps.hash_code.outputs.format == 'true' | |
run: | | |
cd monai_src_dir | |
git commit -sam "[MONAI] algo_template hash update" | |
git diff @~1 | |
git checkout -b auto-update-hash | |
git push -f --set-upstream origin auto-update-hash | |
gh pr create --fill --title "Auto3DSeg algo_template hash update" --base dev --head "auto-update-hash" | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.PR_MAINTAIN_BOT }} |