Skip to content

Commit 24814cb

Browse files
committed
try to uniform the usage of version/tag across the workflow
1 parent a000083 commit 24814cb

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

Diff for: .github/workflows/publish-go-nightly-task.yml

+17-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ on:
2020

2121
jobs:
2222
create-nightly-artifacts:
23+
outputs:
24+
version: ${{ steps.get-version.outputs.version }}
2325
runs-on: ubuntu-latest
2426

2527
strategy:
@@ -50,6 +52,12 @@ jobs:
5052
NIGHTLY: true
5153
run: task dist:${{ matrix.os }}
5254

55+
- name: Output Version
56+
id: get-version
57+
env:
58+
NIGHTLY: true
59+
run: echo "::set-output name=version::$(task get-version)"
60+
5361
- name: Upload artifacts
5462
uses: actions/upload-artifact@v3
5563
with:
@@ -144,8 +152,8 @@ jobs:
144152
# GitHub's upload/download-artifact@v2 actions don't preserve file permissions,
145153
# so we need to add execution permission back until the action is made to do this.
146154
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
147-
# Use of an array here is required for globbing
148-
PACKAGE_FILENAME=(${{ env.PROJECT_NAME }}_nightly-*${{ matrix.artifact.path }})
155+
VERSION=${{ needs.create-nightly-artifacts.outputs.version }}
156+
PACKAGE_FILENAME=(${{ env.PROJECT_NAME }}_${VERSION}_${{ matrix.artifact.path }})
149157
tar -czvf "$PACKAGE_FILENAME" \
150158
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
151159
-C ../../ LICENSE.txt
@@ -189,10 +197,11 @@ jobs:
189197
- name: Build MSI
190198
id: buildmsi
191199
run: |
192-
WIX_TAG="0.0.0" # use 0.0.0 as version for the installer since wix is picky about other alternatives, this only affects nightly builds (error CNDL0242)
193-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_Windows_64bit"
200+
VERSION=${{ needs.create-nightly-artifacts.outputs.version }}
201+
WIX_VERSION="0.0.0" # use 0.0.0 as version for the installer since wix is picky about other alternatives, this only affects nightly builds (error CNDL0242)
202+
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${VERSION}_Windows_64bit"
194203
SOURCE_DIR="${GITHUB_WORKSPACE}/${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_windows_amd64/"
195-
MSBuild.exe ./installer/cli.wixproj -p:SourceDir="$SOURCE_DIR" -p:OutputPath="${GITHUB_WORKSPACE}/${{ env.DIST_DIR }}" -p:OutputName="$PACKAGE_FILENAME" -p:ProductVersion="$WIX_TAG"
204+
MSBuild.exe ./installer/cli.wixproj -p:SourceDir="$SOURCE_DIR" -p:OutputPath="${GITHUB_WORKSPACE}/${{ env.DIST_DIR }}" -p:OutputName="$PACKAGE_FILENAME" -p:ProductVersion="$WIX_VERSION"
196205
197206
- name: Save Win signing certificate to file
198207
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_PFX }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_PFX}}
@@ -216,6 +225,7 @@ jobs:
216225
publish-nightly:
217226
runs-on: ubuntu-latest
218227
needs:
228+
- create-nightly-artifacts
219229
- notarize-macos
220230
- create-windows-installer
221231

@@ -229,8 +239,8 @@ jobs:
229239
- name: Output checksum
230240
working-directory: ${{ env.DIST_DIR}}
231241
run: |
232-
TAG="nightly-$(date -u +"%Y%m%d")"
233-
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >> ${TAG}-checksums.txt
242+
VERSION=${{ needs.create-nightly-artifacts.outputs.version }}
243+
sha256sum ${{ env.PROJECT_NAME }}_${VERSION}* >> ${VERSION}-checksums.txt
234244
235245
# - name: Upload release files on Arduino downloads servers
236246
# uses: docker://plugins/s3

Diff for: .github/workflows/release-go-task.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717

1818
jobs:
1919
create-release-artifacts:
20+
outputs:
21+
version: ${{ steps.get-version.outputs.version }}
2022
runs-on: ubuntu-latest
2123

2224
strategy:
@@ -57,6 +59,10 @@ jobs:
5759
- name: Build
5860
run: task dist:${{ matrix.os }}
5961

62+
- name: Output Version
63+
id: get-version
64+
run: echo "::set-output name=version::$(task get-version)"
65+
6066
- name: Upload artifacts
6167
uses: actions/upload-artifact@v3
6268
with:
@@ -151,7 +157,7 @@ jobs:
151157
# GitHub's upload/download-artifact@v2 actions don't preserve file permissions,
152158
# so we need to add execution permission back until the action is made to do this.
153159
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
154-
TAG="${GITHUB_REF/refs\/tags\//}"
160+
TAG=${{ needs.create-release-artifacts.outputs.version }}
155161
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
156162
tar -czvf "$PACKAGE_FILENAME" \
157163
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
@@ -196,7 +202,7 @@ jobs:
196202
- name: Build MSI
197203
id: buildmsi
198204
run: |
199-
TAG="${GITHUB_REF/refs\/tags\//}"
205+
TAG=${{ needs.create-release-artifacts.outputs.version }}
200206
WIX_TAG="${TAG%%-*}" # removes "-rc*" since wix is not happy with it, this only affects RCs builds (error CNDL0108)
201207
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_Windows_64bit"
202208
SOURCE_DIR="${GITHUB_WORKSPACE}/${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_windows_amd64/"
@@ -224,6 +230,7 @@ jobs:
224230
create-release:
225231
runs-on: ubuntu-latest
226232
needs:
233+
- create-release-artifacts
227234
- notarize-macos
228235
- create-windows-installer
229236

@@ -237,7 +244,7 @@ jobs:
237244
- name: Output checksum
238245
working-directory: ${{ env.DIST_DIR}}
239246
run: |
240-
TAG="${GITHUB_REF/refs\/tags\//}"
247+
TAG=${{ needs.create-release-artifacts.outputs.version }}
241248
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >> ${TAG}-checksums.txt
242249
243250
- name: Identify Prerelease
@@ -247,7 +254,7 @@ jobs:
247254
run: |
248255
wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.0.0.zip
249256
unzip -p /tmp/3.0.0.zip semver-tool-3.0.0/src/semver >/tmp/semver && chmod +x /tmp/semver
250-
if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "::set-output name=IS_PRE::true"; fi
257+
if [[ "$(/tmp/semver get prerel ${{ needs.create-release-artifacts.outputs.version }} )" ]]; then echo "::set-output name=IS_PRE::true"; fi
251258
252259
- name: Create Github Release and upload artifacts
253260
uses: ncipollo/release-action@v1

Diff for: Taskfile.yml

+5
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ tasks:
327327
cmds:
328328
- poetry run mkdocs serve
329329

330+
get-version:
331+
desc: Returns the version used in the project
332+
cmds:
333+
- echo {{.VERSION}}
334+
330335
vars:
331336
PROJECT_NAME: "arduino-cli"
332337
DIST_DIR: "dist"

0 commit comments

Comments
 (0)