1+ name : Release DRE binary
2+ on :
3+ push :
4+ tags :
5+ - " v*"
6+
7+ concurrency :
8+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+ cancel-in-progress : true
10+
11+ jobs :
12+ test :
13+ runs-on :
14+ labels : dre-runner-custom
15+ container : ghcr.io/dfinity/dre/actions-runner:3dd4f38f076cad73fdcc68ad37fd29bed4fa3e4d
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : " ☁️ Setup runner"
20+ uses : ./.github/workflows/manage-runner-pre
21+
22+ - name : " 🚀 Testing"
23+ env :
24+ STAGING_PRIVATE_KEY_PEM : " ${{ secrets.STAGING_PRIVATE_KEY_PEM }}"
25+ run : |
26+ mkdir -p ~/.config/dfx/identity/bootstrap-super-leader/
27+ echo $STAGING_PRIVATE_KEY_PEM > ~/.config/dfx/identity/bootstrap-super-leader/identity.pem
28+ bazel test //rs/cli:unit_test --spawn_strategy=local --test_env=HOME=/home/runner
29+
30+ release :
31+ needs : [ test ]
32+ runs-on :
33+ labels : dre-runner-custom
34+ container : ghcr.io/dfinity/dre/actions-runner:3dd4f38f076cad73fdcc68ad37fd29bed4fa3e4d
35+ permissions :
36+ contents : write
37+ packages : write
38+ pages : write
39+ steps :
40+ - uses : actions/checkout@v4
41+ with :
42+ fetch-tags : true
43+ fetch-depth : 0
44+
45+ - name : " ☁️ Setup runner"
46+ uses : ./.github/workflows/manage-runner-pre
47+
48+ # The GitHub App token is necessary for pushing changed files back to the repository
49+ # If regular secrets.GITHUB_TOKEN is used instead, the push will not trigger any actions
50+ # https://github.com/orgs/community/discussions/25702
51+ - name : Create GitHub App Token
52+ uses : actions/create-github-app-token@v1
53+ id : app-token
54+ with :
55+ app-id : ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }}
56+ private-key : ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }}
57+
58+ - name : Determine tag
59+ shell : bash
60+ id : tag
61+ run : |
62+ TAG=${GITHUB_REF#refs/tags/}
63+ if [[ $TAG == refs/* ]]; then
64+ echo "Invalid value for tag $TAG"
65+ exit 1
66+ fi
67+
68+ echo "Will be using tag $TAG"
69+ echo "tag=$TAG" >> $GITHUB_OUTPUT
70+
71+ - name : Update tags in code
72+ shell : bash
73+ run : |
74+ rye run python bin/mk-release.py ${{ steps.tag.outputs.tag }}
75+
76+ - name : Build artifacts
77+ shell : bash
78+ run : |
79+ cargo install git-cliff
80+ rustup target add x86_64-apple-darwin
81+ CARGO_BAZEL_REPIN=true bazel build --config=ci //rs/cli:dre
82+ cargo drecross
83+
84+ mkdir -p release/artifacts
85+ cp --dereference bazel-out/k8-opt/bin/rs/cli/dre release/artifacts/dre-x86_64-unknown-linux
86+ cp target/x86_64-apple-darwin/release/dre release/artifacts/dre-x86_64-apple-darwin
87+
88+ git cliff --current --sort newest > release/CHANGELOG.md
89+
90+ - name : " 🆕 📢 Prepare release"
91+ # v0.1.15
92+ uses : softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
93+ id : release
94+ with :
95+ token : ${{ secrets.GITHUB_TOKEN }}
96+ name : ${{ steps.tag.outputs.tag }}
97+ tag_name : ${{ steps.tag.outputs.tag }}
98+ body_path : release/CHANGELOG.md
99+ draft : true
100+ prerelease : true
101+ files : |
102+ release/artifacts/*
103+
104+ - name : " Clean up release artifacts"
105+ shell : bash
106+ run : |
107+ rm -rf release
108+
109+ - name : " 🆕 Create a new Pull Request with the changes"
110+ uses : peter-evans/create-pull-request@v7
111+ with :
112+ commit-message : " chore(release): New release of `dre` version ${{ steps.tag.outputs.tag }}"
113+ branch : bot-release-${{ steps.tag.outputs.tag }}
114+ title : " chore(release): New release of `dre` version ${{ steps.tag.outputs.tag }}"
115+ body : |
116+ This PR updates versions in the code used to generate the contents of a new release [${{ steps.tag.outputs.tag }}](${{ steps.release.outputs.url }})
117+
118+ If the release notes are correct, set it as latest release and publish it.
119+ token : ${{ steps.app-token.outputs.token }}
120+ base : main
121+
0 commit comments