Skip to content

Commit bdbad9e

Browse files
committed
ci: Publish release commits for nightly
1 parent 355d413 commit bdbad9e

File tree

2 files changed

+40
-43
lines changed

2 files changed

+40
-43
lines changed

.github/scripts/release.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ def get_current_day_id():
2828
return f'{now.year - 2000}{day}'
2929

3030

31+
def get_tag_name():
32+
now = datetime.now()
33+
current_time_dashes = now.strftime('%Y-%m-%d')
34+
tag_name = f'nightly-{current_time_dashes}'
35+
return tag_name
36+
37+
3138
def github_output(variable, value):
3239
line = f'{variable}={value}'
3340
print(line)
@@ -94,6 +101,21 @@ def bump():
94101
github_output('version4', version4)
95102

96103

104+
def commit():
105+
commit_message = f'Release {cargo_get_version()}'
106+
run_command(['git', 'config', 'user.name', 'RuffleBuild'])
107+
run_command(['git', 'config', 'user.email', 'ruffle@ruffle.rs'])
108+
run_command(['git', 'add', '--update'])
109+
run_command(['git', 'commit', '-m', commit_message])
110+
111+
112+
def tag_and_push():
113+
tag_name = get_tag_name()
114+
run_command(['git', 'tag', tag_name])
115+
run_command(['git', 'push', 'origin', 'tag', tag_name])
116+
github_output('tag_name', tag_name)
117+
118+
97119
def release():
98120
"""
99121
Create a release of Ruffle on GitHub.
@@ -103,7 +125,7 @@ def release():
103125
current_time_dashes = now.strftime('%Y-%m-%d')
104126
current_time_underscores = now.strftime('%Y_%m_%d')
105127

106-
tag_name = f'nightly-{current_time_dashes}'
128+
tag_name = get_tag_name()
107129
release_name = f'Nightly {current_time_dashes}'
108130
package_prefix = f'ruffle-nightly-{current_time_underscores}'
109131
release_options = ['--generate-notes', '--prerelease']
@@ -112,7 +134,7 @@ def release():
112134
run_command([
113135
'gh', 'release', 'create', tag_name,
114136
'--title', release_name,
115-
'--target', release_commit,
137+
'--verify-tag',
116138
*release_options])
117139

118140
github_output('tag_name', tag_name)
@@ -124,6 +146,10 @@ def main():
124146
log(f'Running command {cmd}')
125147
if cmd == 'bump':
126148
bump()
149+
elif cmd == 'commit':
150+
commit()
151+
elif cmd == 'tag-and-push':
152+
tag_and_push()
127153
elif cmd == 'release':
128154
release()
129155

.github/workflows/release_nightly.yml

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
date: ${{ steps.current_time_underscores.outputs.formattedTime }}
2121
upload_url: ${{ steps.create_release.outputs.upload_url }}
2222
package_prefix: ${{ steps.create_release.outputs.package_prefix }}
23-
tag_name: ${{ steps.create_release.outputs.tag_name }}
23+
tag_name: ${{ steps.commit.outputs.tag_name }}
2424
version4: ${{ steps.version.outputs.version4 }}
2525

2626
# Only run the scheduled workflows on the main repo.
@@ -67,22 +67,8 @@ jobs:
6767
if: steps.activity.outputs.is_active == 'true'
6868
id: commit
6969
run: |
70-
# Print diff for debugging
71-
git diff
72-
73-
# For nightly we do not want to commit those changes,
74-
# save them and then apply when building
75-
git diff > /tmp/nightly-release.patch
76-
77-
revision=$(git rev-parse HEAD)
78-
echo "revision=$revision" | tee -a $GITHUB_OUTPUT
79-
80-
- name: Upload nightly release patch
81-
uses: actions/upload-artifact@v4
82-
if: steps.activity.outputs.is_active == 'true'
83-
with:
84-
name: nightly-release-patch
85-
path: /tmp/nightly-release.patch
70+
$RELEASE_SCRIPT commit
71+
$RELEASE_SCRIPT tag-and-push
8672
8773
- name: Get current time with underscores
8874
uses: josStorer/get-current-time@v2.1.2
@@ -147,15 +133,8 @@ jobs:
147133
steps:
148134
- name: Clone Ruffle repo
149135
uses: actions/checkout@v4
150-
151-
- name: Download nightly release patch
152-
uses: actions/download-artifact@v4
153136
with:
154-
name: nightly-release-patch
155-
path: /tmp
156-
157-
- name: Apply nightly release patch
158-
run: git apply --verbose /tmp/nightly-release.patch
137+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
159138

160139
- name: Install Rust toolchain
161140
uses: dtolnay/rust-toolchain@stable
@@ -252,6 +231,8 @@ jobs:
252231
steps:
253232
- name: Clone Ruffle repo
254233
uses: actions/checkout@v4
234+
with:
235+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
255236

256237
- name: Download aarch64 binary
257238
uses: actions/download-artifact@v4
@@ -349,6 +330,8 @@ jobs:
349330
steps:
350331
- name: Clone Ruffle repo
351332
uses: actions/checkout@v4
333+
with:
334+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
352335

353336
- name: Install Rust toolchain
354337
uses: dtolnay/rust-toolchain@stable
@@ -382,15 +365,8 @@ jobs:
382365
steps:
383366
- name: Clone Ruffle repo
384367
uses: actions/checkout@v4
385-
386-
- name: Download nightly release patch
387-
uses: actions/download-artifact@master
388368
with:
389-
name: nightly-release-patch
390-
path: /tmp
391-
392-
- name: Apply nightly release patch
393-
run: git apply --verbose /tmp/nightly-release.patch
369+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
394370

395371
- name: Install Rust toolchain
396372
uses: dtolnay/rust-toolchain@stable
@@ -543,15 +519,8 @@ jobs:
543519
steps:
544520
- name: Clone Ruffle repo
545521
uses: actions/checkout@v4
546-
547-
- name: Download nightly release patch
548-
uses: actions/download-artifact@master
549522
with:
550-
name: nightly-release-patch
551-
path: /tmp
552-
553-
- name: Apply nightly release patch
554-
run: git apply --verbose /tmp/nightly-release.patch
523+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
555524

556525
- name: Install Rust toolchain
557526
uses: dtolnay/rust-toolchain@stable
@@ -731,6 +700,8 @@ jobs:
731700
if: github.repository == 'ruffle-rs/ruffle'
732701
steps:
733702
- uses: actions/checkout@v4
703+
with:
704+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
734705

735706
- name: Get current time with dashes
736707
uses: josStorer/get-current-time@v2.1.2

0 commit comments

Comments
 (0)