1
+ name : Release
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ release-version :
7
+ description : Release version (X.X)
8
+ required : true
9
+ type : string
10
+
11
+ jobs :
12
+ dispatch-release :
13
+ runs-on : ubuntu-latest
14
+ permissions :
15
+ contents : read
16
+
17
+ steps :
18
+ - name : Checkout aggregator repository
19
+ uses : actions/checkout@v4
20
+ with :
21
+ submodules : false
22
+ ref : release-workflow
23
+
24
+ - uses : actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1 v1.11.6
25
+ id : app-token
26
+ name : Generate app token
27
+ with :
28
+ app-id : ${{ vars.GRIDSUITE_ACTIONS_APPID }}
29
+ private-key : ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}
30
+ owner : gridsuite
31
+
32
+ - name : Get GitHub App User ID
33
+ id : get-user-id
34
+ run : |
35
+ echo $(gh api "/users/${RUNGHA_APP_SLUG}[bot]")
36
+ echo "user-id=$(gh api "/users/${RUNGHA_APP_SLUG}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
37
+ env :
38
+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
39
+ RUNGHA_APP_SLUG : ${{ steps.app-token.outputs.app-slug }} # just for defense against script injection
40
+
41
+ - name : Setup git user
42
+ run : |
43
+ git config --global user.name "${RUNGHA_APP_SLUG}[bot]"
44
+ git config --global user.email "${RUNGHA_USER_ID}+${RUNGHA_APP_SLUG}[bot]@users.noreply.github.com"
45
+ env :
46
+ RUNGHA_APP_SLUG : ${{ steps.app-token.outputs.app-slug }} # just for defense against script injection
47
+ RUNGHA_USER_ID : ${{ steps.get-user-id.outputs.user-id }} # just for defense against script injection
48
+
49
+ - name : Load repo list from file or input
50
+ id : load_repos
51
+ run : |
52
+ if [[ -z "${{ github.event.inputs.repos_to_release }}" ]]; then
53
+ echo "ℹ️ No user input → load .github/config/repos-to-release.txt"
54
+ list="$(cat .github/config/repos-to-release.txt)"
55
+ else
56
+ echo "ℹ️ Input found → load user input"
57
+ list="${{ github.event.inputs.repos_to_release }}"
58
+ fi
59
+ echo "list<<EOF" >> $GITHUB_OUTPUT
60
+ echo "$list" >> $GITHUB_OUTPUT
61
+ echo "EOF" >> $GITHUB_OUTPUT
62
+
63
+ - name : Create tags and trigger release workflows
64
+ run : |
65
+ while read url; do
66
+ url_with_token="${url/https:\/\/github.com/https:\/\/x-access-token:${GH_TOKEN}@github.com}"
67
+ git clone "$url_with_token"
68
+ folder=$(basename "$url" .git)
69
+ cd $folder
70
+
71
+ version=${{github.event.inputs.release-version}}
72
+ branch_name="prepare-release-$version"
73
+ # Check if *branch_name* already exists
74
+ if ! git ls-remote --exit-code origin "refs/heads/$branch_name"; then
75
+ echo "❌ Warning for $folder: Branch $branch_name does not exist"
76
+ exit 1
77
+ fi
78
+ git checkout "$branch_name"
79
+
80
+ tag_name="v$version"
81
+ # Créer le tag
82
+ git tag "$tag_name"
83
+
84
+ # Pousser le tag
85
+ git push origin "$tag_name"
86
+
87
+ gh api repos/gridsuite/$folder/actions/workflows/release.yml/dispatches \
88
+ -f ref=main \
89
+ -f inputs.releaseVersion="v${{ github.event.inputs.release-version }}"
90
+
91
+ cd -
92
+ done <<< "${{ steps.load_repos.outputs.list }}"
93
+ env :
94
+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
0 commit comments