|
91 | 91 |
|
92 | 92 | env: |
93 | 93 | SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }} |
94 | | - |
| 94 | + GIT_SERVBOT_USER: ${{ secrets.GIT_SERVBOT_USER }} |
| 95 | + GIT_SERVBOT_EMAIL: ${{ secrets.GIT_SERVBOT_EMAIL }} |
| 96 | + GO_PUSH: 0 |
| 97 | + GIT_PUSH_SERVBOT_PAT: ${{ secrets.GIT_PUSH_SERVBOT_PAT }} |
| 98 | + |
95 | 99 | if: ${{ github.repository_owner == 'OpenRadioss' }} |
96 | 100 | # DEV ONLY # runs-on: ["${{ matrix.build }}","dev_pmci"] |
97 | 101 | # runs-on: ["${{ matrix.build }}","prmerge_ci"] |
@@ -131,88 +135,123 @@ jobs: |
131 | 135 | clean: 'false' |
132 | 136 | lfs: 'false' |
133 | 137 |
|
134 | | - - name: Remove possible reliquat of fake artifact* |
| 138 | + - name: Set version in file |
135 | 139 | working-directory: ${{ env.WORKDIR }} |
136 | 140 | run: | |
137 | | - rm -rf exec || echo "Nothing to remove in exec/" |
| 141 | + mydate=$(date '+%Y-%m-%d %H:%M:%S') |
| 142 | + echo "{\"version\": \"1.0.0\",\"delivery_date\":\"${mydate}\",\"url\": \"https://example.com\"}" > fake_version.json |
| 143 | +
|
| 144 | + # Add new files |
| 145 | + git config --global user.email "${{ env.GIT_SERVBOT_EMAIL }}" |
| 146 | + git config --global user.name "${{ env.GIT_SERVBOT_USER }}" |
| 147 | + git add . |
| 148 | + git status |
| 149 | +
|
| 150 | + if [[ -n $(git status --porcelain) ]]; then |
| 151 | + # Set correct end of step status (if not an email will be sent) |
| 152 | + echo "GO_PUSH=1" >> $GITHUB_ENV |
| 153 | + else |
| 154 | + echo "There are no changes in the repository, abort." |
| 155 | + exit 1 |
| 156 | + fi |
138 | 157 |
|
139 | | - - name: Download built artifacts |
140 | | - uses: actions/download-artifact@v8 |
141 | | - with: |
142 | | - name: bins-linux64-starter_linux64_gf |
143 | | - path: ${{ env.WORKDIR }}/exec |
| 158 | + git commit -m "Update fake version to ${mydate}" |
144 | 159 |
|
145 | | - - name: Check exec |
146 | | - working-directory: ${{ env.WORKDIR }} |
147 | | - run: | |
148 | | - ls -l exec || echo "Nothing in exec/" |
149 | | - echo "MADATE=$(date '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV |
150 | | - echo "LAST_STABLE_TAG_NAME=latest-20260319" >> $GITHUB_ENV |
151 | | -
|
152 | | - - uses: octokit/request-action@v3.x |
153 | | - id: close_branch_qa |
154 | | - env: |
155 | | - GITHUB_TOKEN: ${{ env.SERVBOT_PAT }} |
156 | | - REQUEST_BODY: "['${{ env.TEAM_RESTRICTIVE_CLOSED_BRANCH}}']" |
| 160 | + - name: Push changes |
| 161 | + uses: ad-m/github-push-action@master |
| 162 | + if: ${{ env.GO_PUSH == 1 }} |
157 | 163 | with: |
158 | | - route: PUT /repos/${{ github.repository }}/branches/main/protection/restrictions/teams |
159 | | - data: ${{ env.REQUEST_BODY }} |
160 | | - |
161 | | - - name: Create GitHub Discussion |
162 | | - uses: actions/github-script@v8 |
163 | | - with: |
164 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
165 | | - script: | |
166 | | - // Get the discussion categories for your repository |
167 | | - const { data: repository } = await github.rest.repos.get({ |
168 | | - owner: context.repo.owner, |
169 | | - repo: context.repo.repo |
170 | | - }); |
171 | | -
|
172 | | - // Create discussion using GraphQL |
173 | | - const query = ` |
174 | | - query { |
175 | | - repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") { |
176 | | - id |
177 | | - discussionCategories(first: 10) { |
178 | | - nodes { |
179 | | - id |
180 | | - name |
181 | | - } |
182 | | - } |
183 | | - } |
184 | | - } |
185 | | - `; |
186 | | -
|
187 | | - const result = await github.graphql(query); |
188 | | - const repoId = result.repository.id; |
189 | | - const categories = result.repository.discussionCategories.nodes; |
| 164 | + github_token: ${{ env.GIT_PUSH_SERVBOT_PAT }} |
| 165 | + branch: ${{ github.ref }} |
| 166 | + directory: ${{ env.WORKDIR }} |
| 167 | + |
| 168 | + # - name: Remove possible reliquat of fake artifact* |
| 169 | + # working-directory: ${{ env.WORKDIR }} |
| 170 | + # run: | |
| 171 | + # rm -rf exec || echo "Nothing to remove in exec/" |
| 172 | + |
| 173 | + # - name: Download built artifacts |
| 174 | + # uses: actions/download-artifact@v8 |
| 175 | + # with: |
| 176 | + # name: bins-linux64-starter_linux64_gf |
| 177 | + # path: ${{ env.WORKDIR }}/exec |
| 178 | + |
| 179 | + # - name: Check exec |
| 180 | + # working-directory: ${{ env.WORKDIR }} |
| 181 | + # run: | |
| 182 | + # ls -l exec || echo "Nothing in exec/" |
| 183 | + # echo "MADATE=$(date '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV |
| 184 | + # echo "LAST_STABLE_TAG_NAME=latest-20260319" >> $GITHUB_ENV |
| 185 | + |
| 186 | + # - uses: octokit/request-action@v3.x |
| 187 | + # id: close_branch_qa |
| 188 | + # env: |
| 189 | + # GITHUB_TOKEN: ${{ env.SERVBOT_PAT }} |
| 190 | + # REQUEST_BODY: "['${{ env.TEAM_RESTRICTIVE_CLOSED_BRANCH}}']" |
| 191 | + # with: |
| 192 | + # route: PUT /repos/${{ github.repository }}/branches/main/protection/restrictions/teams |
| 193 | + # data: ${{ env.REQUEST_BODY }} |
| 194 | + |
| 195 | + # - name: Create GitHub Discussion |
| 196 | + # uses: actions/github-script@v8 |
| 197 | + # with: |
| 198 | + # github-token: ${{ secrets.GITHUB_TOKEN }} |
| 199 | + # script: | |
| 200 | + # // Get the discussion categories for your repository |
| 201 | + # const { data: repository } = await github.rest.repos.get({ |
| 202 | + # owner: context.repo.owner, |
| 203 | + # repo: context.repo.repo |
| 204 | + # }); |
| 205 | + |
| 206 | + # // Create discussion using GraphQL |
| 207 | + # const query = ` |
| 208 | + # query { |
| 209 | + # repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") { |
| 210 | + # id |
| 211 | + # discussionCategories(first: 10) { |
| 212 | + # nodes { |
| 213 | + # id |
| 214 | + # name |
| 215 | + # } |
| 216 | + # } |
| 217 | + # } |
| 218 | + # } |
| 219 | + # `; |
| 220 | + |
| 221 | + # const result = await github.graphql(query); |
| 222 | + # const repoId = result.repository.id; |
| 223 | + # const categories = result.repository.discussionCategories.nodes; |
190 | 224 |
|
191 | | - // Use first available category or create with a default |
192 | | - const categoryId = categories.length > 0 ? categories[0].id : null; |
| 225 | + # // Use first available category or create with a default |
| 226 | + # const categoryId = categories.length > 0 ? categories[0].id : null; |
193 | 227 |
|
194 | | - if (categoryId) { |
195 | | - const createMutation = ` |
196 | | - mutation CreateDiscussion($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) { |
197 | | - createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) { |
198 | | - discussion { |
199 | | - url |
200 | | - } |
201 | | - } |
202 | | - } |
203 | | - `; |
| 228 | + # if (categoryId) { |
| 229 | + # const createMutation = ` |
| 230 | + # mutation CreateDiscussion($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) { |
| 231 | + # createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) { |
| 232 | + # discussion { |
| 233 | + # url |
| 234 | + # } |
| 235 | + # } |
| 236 | + # } |
| 237 | + # `; |
204 | 238 |
|
205 | | - const discussion = await github.graphql(createMutation, { |
206 | | - repositoryId: repoId, |
207 | | - categoryId: categoryId, |
208 | | - title: `DEV OpenRadioss Stable Update (${process.env.LAST_STABLE_TAG_NAME})`, |
209 | | - body: `We're excited to announce a new **stable release of OpenRadioss!**\nThis version, based on **tag ${process.env.LAST_STABLE_TAG_NAME}**, brings improved stability and performance based on community feedback.\n🔹 [Get it now](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/XXXX)\nPlease, try it out and share your appreciated feedback, thanks!` |
210 | | - }); |
| 239 | + # const discussion = await github.graphql(createMutation, { |
| 240 | + # repositoryId: repoId, |
| 241 | + # categoryId: categoryId, |
| 242 | + # title: `DEV OpenRadioss Stable Update (${process.env.LAST_STABLE_TAG_NAME})`, |
| 243 | + # body: `We're excited to announce a new **stable release of OpenRadioss!**\nThis version, based on **tag ${process.env.LAST_STABLE_TAG_NAME}**, brings improved stability and performance based on community feedback.\n🔹 [Get it now](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/XXXX)\nPlease, try it out and share your appreciated feedback, thanks!` |
| 244 | + # }); |
211 | 245 |
|
212 | | - console.log(`Discussion created: ${discussion.createDiscussion.discussion.url}`); |
213 | | - } else { |
214 | | - console.log('No discussion categories found. Please create discussion categories first.'); |
215 | | - } |
| 246 | + # console.log(`Discussion created: ${discussion.createDiscussion.discussion.url}`); |
| 247 | + # } else { |
| 248 | + # console.log('No discussion categories found. Please create discussion categories first.'); |
| 249 | + # } |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | + |
216 | 255 |
|
217 | 256 | # build_linux: |
218 | 257 | # if: ${{ github.repository_owner == 'OpenRadioss' }} |
|
0 commit comments