Skip to content

Commit dc765e6

Browse files
authored
Check if file exists before attempt to move file for release build (#902)
* autobuild release: check if file exists before mv * autobuild release: add workflow dispatch for manual trigger
1 parent 80ac678 commit dc765e6

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ name: "FujiNet Tagged Version Release"
22

33
on:
44
push:
5-
# branches:
6-
# - release
75
tags:
86
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Tag name to use (e.g., v1.0.0)"
11+
required: true
12+
type: string
913

1014
jobs:
1115
tagged-release:
@@ -14,12 +18,14 @@ jobs:
1418
strategy:
1519
matrix:
1620
target-platform: [ATARI, ATARI-8mb, ADAM, APPLE, COCO, IEC-LOLIN-D32, MASTERIES-REVAB, MASTERIES-REVA-SPIFIX]
21+
env:
22+
TAG_NAME: ${{ github.event.inputs.tag || github.ref_name }}
1723

1824
steps:
1925
- name: Checkout Source
2026
uses: actions/checkout@v4
2127
with:
22-
ref: ${{ github.ref_name }}
28+
ref: ${{ env.TAG_NAME }}
2329
fetch-depth: 0
2430

2531
- name: Cache pip
@@ -86,7 +92,7 @@ jobs:
8692
- name: Rename firmware file if needed
8793
shell: bash
8894
run: |
89-
mv firmware/fujinet-*.zip firmware/fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
95+
[ ! -f firmware/fujinet-${{ matrix.target-platform }}-${{ env.TAG_NAME }}.zip ] && mv firmware/fujinet-*.zip firmware/fujinet-${{ matrix.target-platform }}-${{ env.TAG_NAME }}.zip
9096
9197
- name: Fetch Tag Info
9298
run: git fetch --tags --force
@@ -98,20 +104,19 @@ jobs:
98104
- name: Show Tag Annotation
99105
run: echo ${{ steps.tag-data.outputs.git-tag-annotation }}
100106

101-
# Grab tag message to use for platform release json description if available
102107
- name: Create JSON Description from Tag Annotation if Available
103108
if: ${{ steps.tag-data.outputs.git-tag-annotation != '' }}
104109
run: echo "${{ steps.tag-data.outputs.git-tag-annotation }}" > firmware/annotation.txt
105110

106111
- name: Prepare platform release JSON
107-
run: .github/workflows/preprelease.sh ${{ matrix.target-platform }} ${{ github.ref_name }} ${{ github.repository_owner }}
112+
run: .github/workflows/preprelease.sh ${{ matrix.target-platform }} ${{ env.TAG_NAME }} ${{ github.repository_owner }}
108113
shell: bash
109114

110115
- name: Upload Release ZIP
111116
uses: actions/upload-artifact@v4
112117
with:
113-
name: fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
114-
path: firmware/fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
118+
name: fujinet-${{ matrix.target-platform }}-${{ env.TAG_NAME }}.zip
119+
path: firmware/fujinet-${{ matrix.target-platform }}-${{ env.TAG_NAME }}.zip
115120

116121
- name: Upload Releases JSON
117122
uses: actions/upload-artifact@v4
@@ -122,19 +127,18 @@ jobs:
122127
- name: Push Files to Release
123128
uses: softprops/action-gh-release@v1
124129
with:
125-
tag_name: ${{ github.ref_name }}
130+
tag_name: ${{ env.TAG_NAME }}
126131
files: |
127-
firmware/fujinet-${{ matrix.target-platform }}-${{ github.ref_name }}.zip
132+
firmware/fujinet-${{ matrix.target-platform }}-${{ env.TAG_NAME }}.zip
128133
firmware/releases-${{ matrix.target-platform }}.json
129134
130135
- name: Get Git Short SHA
131136
id: shortsha
132137
run: |
133138
echo "SHORTSHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
134139
135-
# Notify fujinet.online to add the new firmware to FujiNet-flasher
136140
- name: Notify FujiNet server
137-
run: wget "https://fujinet.online/newfirmware.php?version=${{ github.ref_name }}&platform=${{ matrix.target-platform }}&githash=${{ steps.shortsha.outputs.SHORTSHA }}"
141+
run: wget "https://fujinet.online/newfirmware.php?version=${{ env.TAG_NAME }}&platform=${{ matrix.target-platform }}&githash=${{ steps.shortsha.outputs.SHORTSHA }}"
138142

139143
push-changelog:
140144
name: "Push Change Log"
@@ -145,15 +149,18 @@ jobs:
145149
uses: actions/checkout@v4
146150
with:
147151
fetch-depth: 0
152+
148153
- name: Save commits to change log
149154
run: git log $(git describe --tags --abbrev=0 @^ 2> /dev/null)..@ --oneline > CHANGE.log
155+
150156
- name: Upload Change Log
151157
uses: actions/upload-artifact@v4
152158
with:
153159
name: CHANGE.log
154160
path: CHANGE.log
161+
155162
- name: Push Change log to Release
156163
uses: softprops/action-gh-release@v1
157164
with:
158-
tag_name: ${{ github.ref_name }}
165+
tag_name: ${{ env.TAG_NAME }}
159166
files: CHANGE.log

0 commit comments

Comments
 (0)