Skip to content

Commit 48f99a8

Browse files
Merge pull request #10 from vcmi/release-from-run
add workflow to create release from a given Actions run
2 parents e638a6b + b723804 commit 48f99a8

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

.github/workflows/rebuildDependencies.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths-ignore:
66
- README.md
7+
- .github/workflows/releaseFromRun.yml
78
workflow_dispatch:
89

910
jobs:

.github/workflows/releaseFromRun.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Create release from Actions run
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
run_id:
6+
description: 'Actions run ID which to get artifacts from'
7+
required: true
8+
type: number
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
env:
13+
LISTS_DIR: lists
14+
DEPENDENCIES_DIR: deps
15+
GH_TOKEN: ${{ github.token }}
16+
steps:
17+
- name: Download artifacts
18+
run: |
19+
gh run download ${{ github.event.inputs.run_id }} \
20+
--repo ${{ github.repository }} \
21+
--dir "$LISTS_DIR" \
22+
--pattern "list of*"
23+
gh run download ${{ github.event.inputs.run_id }} \
24+
--repo ${{ github.repository }} \
25+
--dir "$DEPENDENCIES_DIR" \
26+
--pattern "dependencies-*"
27+
28+
- name: Create release
29+
shell: python
30+
run: |
31+
from datetime import date
32+
from glob import glob
33+
from os import getenv
34+
from pathlib import Path
35+
from subprocess import run
36+
37+
releaseNotes = "Generated from [this](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.inputs.run_id }}) Actions run"
38+
for packageListPath in sorted(Path(".").glob(f"{getenv("LISTS_DIR")}/**/*.txt")):
39+
releaseNotes += f"""
40+
41+
<details><summary><b>{packageListPath.stem.removeprefix("dependencies-")}</b> packages</summary>
42+
43+
{open(packageListPath, "r").read()}
44+
</details>"""
45+
46+
tag = str(date.today())
47+
dependencies = glob(f"{getenv("DEPENDENCIES_DIR")}/**/*.tgz")
48+
run([
49+
"gh", "release", "create", tag,
50+
"--repo", "${{ github.repository }}",
51+
"--prerelease",
52+
"--title", tag,
53+
"--notes", releaseNotes,
54+
] + dependencies, check=True)

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Current flow to update dependencies:
66
1. Open PR with changes
77
2. Make sure that CI build succeeds
88
3. Merge the PR
9-
4. (TBD) Run workflow to create new release from the CI run
9+
4. Run workflow to create new release from the CI run
1010
5. (TBD) Update dependencies submodule and prebuilts URL in VCMI repo to point to the new commit / release, update VCMI code if needed
1111

1212
# TODO List
@@ -19,5 +19,3 @@ Current flow to update dependencies:
1919
- Rebuild ffmpeg with libdav1d and av1 support enabled. Needs investigation as to why dav1d fails to build on mingw and on android.
2020

2121
- Run CI with full package rebuild on schedule (weekly? monthly?) to detect any regressions or breaking changes in CI or in used recipes
22-
23-
- (shouldn't be needed probably) Automatically generate Github release with updated packages as part of CI. Should probably be done only for changes in main branch and/or for manually triggered workflows

0 commit comments

Comments
 (0)