Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a643efb

Browse files
authored
[ci] build: automate messages on released prs (#29819)
* [ci] build: automate messages on released prs * [ci] build: support manual dispatch or automatic * [ci] chore: proper variable * [ci] fix: dont collide vars * fix: ensure tag is passed between jobs * chore: refer to latest.txt as latest_fl_version.txt
1 parent 8f740e9 commit a643efb

4 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎.github/workflows/announce_release.yml‎

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,46 @@ on:
77
- master
88
types:
99
- completed
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Version to announce'
14+
required: true
1015
permissions:
16+
actions: read
17+
contents: read
1118
issues: write
1219
pull-requests: write
1320

1421
jobs:
1522
announce-release-on-released-pull-requests:
1623
name: Announce release on released pull requests
1724
runs-on: ubuntu-latest
18-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
25+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
1926
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v6
27+
- name: Download release tag artifact
28+
if: ${{ github.event_name == 'workflow_run' }}
29+
uses: actions/download-artifact@v7
2230
with:
23-
ref: master
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
32+
run-id: ${{ github.event.workflow_run.id }}
33+
name: release_tag
34+
35+
- name: Extract version from artifact
36+
if: ${{ github.event_name == 'workflow_run' }}
37+
run: |
38+
if [ ! -f "latest_fl_version.txt" ]; then
39+
echo "latest_fl_version.txt not found in expected locations"
40+
exit 1
41+
fi
42+
echo "FL_VERSION=$(cat latest_fl_version.txt)" >> "$GITHUB_ENV"
43+
44+
- name: Set version from workflow_dispatch input
45+
if: ${{ github.event_name == 'workflow_dispatch' }}
46+
run: echo "FL_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_ENV"
47+
2448
- name: Announce release on released pull requests
2549
uses: fastlane/github-actions/communicate-on-pull-request-released@latest
2650
with:
51+
version: ${{ env.FL_VERSION }}
2752
repo-token: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/release_step_2_create_github_release.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ jobs:
5555
SLACK_URL: ${{ secrets.SLACK_URL }}
5656
run: |
5757
bundle exec fastlane create_github_release skip_github_packages:${{ github.event.inputs.skip_github_packages }} skip_rubygems:${{ github.event.inputs.skip_rubygems }}
58+
59+
- uses: actions/upload-artifact@v6
60+
with:
61+
name: release_tag
62+
path: latest_fl_version.txt
63+
retention-days: 1

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test_output/
1414
.DS_Store
1515
.keys
1616
*.swp
17+
latest_fl_version.txt
1718

1819
## Specific to Android
1920
.gradle/

‎fastlane/Fastfile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ lane :create_github_release do |options|
251251
UI.user_error!("Version number #{version} was already deployed")
252252
end
253253

254+
# Set the version into an ENV variable for GitHub Actions to read
255+
ENV['FASTLANE_RELEASE_VERSION'] = version
256+
254257
github_username = ENV["RELEASE_GITHUB_USERNAME"] || "fastlane"
255258
repo_name = "#{github_username}/fastlane"
256259

@@ -279,6 +282,7 @@ lane :create_github_release do |options|
279282
release_url = github_release['html_url']
280283
message = [title, description, release_url].join("\n\n")
281284
add_fastlane_git_tag(tag: "fastlane/#{version}", message: message)
285+
File.write("../latest_fl_version.txt", version)
282286

283287
UI.success("New GitHub release has been created: #{release_url}")
284288
else

0 commit comments

Comments
 (0)