Skip to content

Commit dea4d2e

Browse files
authored
Merge pull request #2360 from ghutchis/enh-add-continuous-release
Add a "continuous" release (prelease) and upload builds
2 parents 513ce5e + b78ce7c commit dea4d2e

File tree

6 files changed

+93
-2
lines changed

6 files changed

+93
-2
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Uploads build artifacts to a tagged or continuous GitHub release
2+
# Inspired by GH cli docs https://cli.github.com/manual/gh_release
3+
4+
name: "Upload to Release or Continuous"
5+
description: "Uploads build artifacts to a tagged or continuous GitHub release"
6+
inputs:
7+
artifacts:
8+
description: "Path or glob to artifacts to upload"
9+
required: true
10+
release_name:
11+
description: "Release name for non-tag builds (default: continuous)"
12+
required: false
13+
default: "continuous"
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Determine release tag
18+
id: tag
19+
shell: bash
20+
run: |
21+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
22+
echo "release_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
23+
else
24+
# i.e. continuous
25+
echo "release_tag=${{ inputs.release_name }}" >> $GITHUB_OUTPUT
26+
fi
27+
28+
- name: Create or update release
29+
shell: bash
30+
run: |
31+
tag="${{ steps.tag.outputs.release_tag }}"
32+
build_date=$(date -u +"%Y-%m-%d %H:%M UTC")
33+
notes="Automated build on ${build_date} from ${GITHUB_SHA}"
34+
35+
if gh release view "$tag" &>/dev/null; then
36+
# only update the "continous" tag
37+
# so we don't break the release notes for other tags
38+
if [[ "$tag" == "${{ inputs.release_name }}" ]]; then
39+
echo "Updating existing release: $tag"
40+
gh release edit "$tag" --notes "$notes"
41+
fi
42+
else
43+
echo "Creating release: $tag"
44+
gh release create "$tag" --prerelease --title "$tag" --notes "$notes"
45+
fi
46+
47+
- name: Upload artifacts
48+
shell: bash
49+
run: |
50+
# --clobber will overwrite existing artifacts
51+
gh release upload "${{ steps.vars.outputs.release_tag }}" ${{ inputs.artifacts }} --clobber

.github/workflows/build_linux.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ jobs:
148148
path: ${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*
149149
name: ${{ matrix.config.artifact }}
150150

151+
- name: Upload release assets
152+
if: matrix.config.artifact != 0 && github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
153+
uses: ./.github/actions/upload-release
154+
env:
155+
GH_TOKEN: ${{ github.token }}
156+
with:
157+
artifacts: "${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*"
158+
151159
- name: Setup tmate session
152160
if: ${{ failure() }}
153161
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23

.github/workflows/build_linux_arm64.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ jobs:
119119
path: ${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*
120120
name: ${{ matrix.config.artifact }}
121121

122+
- name: Upload release assets
123+
if: matrix.config.artifact != 0 && github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
124+
uses: ./.github/actions/upload-release
125+
env:
126+
GH_TOKEN: ${{ github.token }}
127+
with:
128+
artifacts: "${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*"
129+
122130
- name: Setup tmate session
123131
if: ${{ failure() }}
124132
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23

.github/workflows/build_mac.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ jobs:
217217
path: ${{ runner.workspace }}/build/Avogadro2*.*
218218
name: ${{ matrix.config.artifact }}
219219

220+
- name: Upload release assets
221+
uses: ./.github/actions/upload-release
222+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
223+
env:
224+
GH_TOKEN: ${{ github.token }}
225+
with:
226+
artifacts: "${{ runner.workspace }}/build/Avogadro2*.dmg"
227+
220228
- name: Setup tmate session
221229
if: ${{ failure() }}
222230
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23

.github/workflows/build_win_arm.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
VERSION=$(date +%Y-%m-%d)
102102
fi
103103
104-
mv Avogadro2-Setup.exe ../Avogadro2-${VERSION}.exe
104+
mv Avogadro2-Setup.exe ../Avogadro2-${VERSION}-arm64.exe
105105
working-directory: ${{ runner.workspace }}/build/
106106
env:
107107
GH_TOKEN: ${{ github.token }}
@@ -114,6 +114,14 @@ jobs:
114114
path: ${{ runner.workspace }}/build/Avogadro2*.*
115115
name: ${{ matrix.config.artifact }}
116116

117+
- name: Upload release assets
118+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
119+
uses: ./.github/actions/upload-release
120+
env:
121+
GH_TOKEN: ${{ github.token }}
122+
with:
123+
artifacts: "${{ runner.workspace }}/build/Avogadro2*.*"
124+
117125
- name: Sign Windows release
118126
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
119127
uses: signpath/github-action-submit-signing-request@3f9250c56651ff692d6729a2fbb0603a42d7d322 # v2.0

.github/workflows/build_windows.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
VERSION=$(date +%Y-%m-%d)
102102
fi
103103
104-
mv Avogadro2-Setup.exe ../Avogadro2-${VERSION}.exe
104+
mv Avogadro2-Setup.exe ../Avogadro2-${VERSION}-win64.exe
105105
working-directory: ${{ runner.workspace }}/build/
106106
env:
107107
GH_TOKEN: ${{ github.token }}
@@ -114,6 +114,14 @@ jobs:
114114
path: ${{ runner.workspace }}/build/Avogadro2*.*
115115
name: ${{ matrix.config.artifact }}
116116

117+
- name: Upload release assets
118+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
119+
uses: ./.github/actions/upload-release
120+
env:
121+
GH_TOKEN: ${{ github.token }}
122+
with:
123+
artifacts: "${{ runner.workspace }}/build/Avogadro2*.*"
124+
117125
- name: Sign Windows release
118126
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
119127
uses: signpath/github-action-submit-signing-request@3f9250c56651ff692d6729a2fbb0603a42d7d322 # v2.0

0 commit comments

Comments
 (0)