Skip to content

Commit d1b4565

Browse files
Sync workflow duplicates
1 parent 5a65e94 commit d1b4565

File tree

3 files changed

+116
-86
lines changed

3 files changed

+116
-86
lines changed

workflow-templates/dependabot/workflow-template-copies/.github/workflows/publish-go-nightly-task.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ jobs:
2222
create-nightly-artifacts:
2323
runs-on: ubuntu-latest
2424

25+
strategy:
26+
matrix:
27+
os:
28+
- Windows_32bit
29+
- Windows_64bit
30+
- Linux_32bit
31+
- Linux_64bit
32+
- Linux_ARMv6
33+
- Linux_ARMv7
34+
- Linux_ARM64
35+
- macOS_64bit
36+
- macOS_ARM64
37+
2538
steps:
2639
- name: Checkout repository
2740
uses: actions/checkout@v3
@@ -35,7 +48,7 @@ jobs:
3548
- name: Build
3649
env:
3750
NIGHTLY: true
38-
run: task dist:all
51+
run: task dist:${{ matrix.os }}
3952

4053
- name: Upload artifacts
4154
uses: actions/upload-artifact@v3
@@ -128,14 +141,10 @@ jobs:
128141
run: |
129142
gon "${{ env.GON_CONFIG_PATH }}"
130143
131-
- name: Re-package binary and output checksum
144+
- name: Re-package binary
132145
id: re-package
133146
working-directory: ${{ env.DIST_DIR }}
134-
# This step performs the following:
135-
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
136-
# 2. Recalculate package checksum
137-
# 3. Output the new checksum to include in the nnnnnn-checksums.txt file
138-
# (it cannot be done there because of workflow job parallelization)
147+
# Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
139148
run: |
140149
# GitHub's upload/download-artifact actions don't preserve file permissions,
141150
# so we need to add execution permission back until the action is made to do this.
@@ -145,11 +154,9 @@ jobs:
145154
tar -czvf "$PACKAGE_FILENAME" \
146155
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
147156
-C ../../ LICENSE.txt
148-
CHECKSUM_LINE="$(shasum -a 256 $PACKAGE_FILENAME)"
149157
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
150-
echo "::set-output name=checksum-${{ matrix.artifact.name }}::$CHECKSUM_LINE"
151158
152-
- name: Upload artifacts
159+
- name: Upload artifact
153160
uses: actions/upload-artifact@v3
154161
with:
155162
if-no-files-found: error
@@ -167,15 +174,11 @@ jobs:
167174
name: ${{ env.ARTIFACT_NAME }}
168175
path: ${{ env.DIST_DIR }}
169176

170-
- name: Update checksum
177+
- name: Create checksum file
178+
working-directory: ${{ env.DIST_DIR}}
171179
run: |
172-
declare -a checksum_lines=("${{ needs.notarize-macos.outputs.checksum-darwin_amd64 }}" "${{ needs.notarize-macos.outputs.checksum-darwin_arm64 }}")
173-
for checksum_line in "${checksum_lines[@]}"
174-
do
175-
CHECKSUM=$(echo ${checksum_line} | cut -d " " -f 1)
176-
PACKAGE_FILENAME=$(echo ${checksum_line} | cut -d " " -f 2)
177-
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CHECKSUM} ${PACKAGE_FILENAME}/g;" ${{ env.DIST_DIR }}/*-checksums.txt
178-
done
180+
TAG="nightly-$(date -u +"%Y%m%d")"
181+
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* > ${TAG}-checksums.txt
179182
180183
- name: Upload release files on Arduino downloads servers
181184
uses: docker://plugins/s3

workflow-templates/dependabot/workflow-template-copies/.github/workflows/publish-go-tester-task.yml

+73-51
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ on:
2424
repository_dispatch:
2525

2626
env:
27+
# As defined by the Taskfile's PROJECT_NAME variable
28+
PROJECT_NAME: TODO_PROJECT_NAME
2729
# As defined by the Taskfile's DIST_DIR variable
2830
DIST_DIR: dist
29-
BUILDS_ARTIFACT: build-artifacts
3031

3132
jobs:
3233
run-determination:
@@ -52,86 +53,107 @@ jobs:
5253
5354
echo "::set-output name=result::$RESULT"
5455
55-
build:
56+
package-name-prefix:
5657
needs: run-determination
5758
if: needs.run-determination.outputs.result == 'true'
5859
runs-on: ubuntu-latest
59-
60+
outputs:
61+
prefix: ${{ steps.calculation.outputs.prefix }}
6062
steps:
61-
- name: Checkout repository
62-
uses: actions/checkout@v3
63-
64-
- name: Install Task
65-
uses: arduino/setup-task@v1
66-
with:
67-
repo-token: ${{ secrets.GITHUB_TOKEN }}
68-
version: 3.x
69-
70-
- name: Build
63+
- name: package name prefix calculation
64+
id: calculation
7165
run: |
7266
PACKAGE_NAME_PREFIX="test"
7367
if [ "${{ github.event_name }}" = "pull_request" ]; then
7468
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
7569
fi
7670
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
77-
export PACKAGE_NAME_PREFIX
78-
task dist:all
7971
80-
# Transfer builds to artifacts job
81-
- name: Upload combined builds artifact
82-
uses: actions/upload-artifact@v3
83-
with:
84-
path: ${{ env.DIST_DIR }}
85-
name: ${{ env.BUILDS_ARTIFACT }}
72+
echo "::set-output name=prefix::$PACKAGE_NAME_PREFIX"
8673
87-
artifacts:
88-
name: ${{ matrix.artifact.name }} artifact
89-
needs: build
74+
build:
75+
needs: package-name-prefix
76+
name: Build ${{ matrix.os.name }}
9077
runs-on: ubuntu-latest
9178

9279
strategy:
9380
matrix:
94-
artifact:
95-
- path: "*checksums.txt"
96-
name: checksums
97-
- path: "*Linux_32bit.tar.gz"
81+
os:
82+
- task: Windows_32bit
83+
path: "*Windows_32bit.zip"
84+
name: Windows_X86-32
85+
- task: Windows_64bit
86+
path: "*Windows_64bit.zip"
87+
name: Windows_X86-64
88+
- task: Linux_32bit
89+
path: "*Linux_32bit.tar.gz"
9890
name: Linux_X86-32
99-
- path: "*Linux_64bit.tar.gz"
91+
- task: Linux_64bit
92+
path: "*Linux_64bit.tar.gz"
10093
name: Linux_X86-64
101-
- path: "*Linux_ARM64.tar.gz"
102-
name: Linux_ARM64
103-
- path: "*Linux_ARMv6.tar.gz"
94+
- task: Linux_ARMv6
95+
path: "*Linux_ARMv6.tar.gz"
10496
name: Linux_ARMv6
105-
- path: "*Linux_ARMv7.tar.gz"
97+
- task: Linux_ARMv7
98+
path: "*Linux_ARMv7.tar.gz"
10699
name: Linux_ARMv7
107-
- path: "*macOS_64bit.tar.gz"
100+
- task: Linux_ARM64
101+
path: "*Linux_ARM64.tar.gz"
102+
name: Linux_ARM64
103+
- task: macOS_64bit
104+
path: "*macOS_64bit.tar.gz"
108105
name: macOS_64
109-
- path: "*macOS_ARM64.tar.gz"
106+
- task: macOS_ARM64
107+
path: "*macOS_ARM64.tar.gz"
110108
name: macOS_ARM64
111-
- path: "*Windows_32bit.zip"
112-
name: Windows_X86-32
113-
- path: "*Windows_64bit.zip"
114-
name: Windows_X86-64
115109

116110
steps:
117-
- name: Download combined builds artifact
118-
uses: actions/download-artifact@v3
111+
- name: Checkout repository
112+
uses: actions/checkout@v3
113+
114+
- name: Install Task
115+
uses: arduino/setup-task@v1
119116
with:
120-
name: ${{ env.BUILDS_ARTIFACT }}
121-
path: ${{ env.BUILDS_ARTIFACT }}
117+
repo-token: ${{ secrets.GITHUB_TOKEN }}
118+
version: 3.x
122119

123-
- name: Upload individual build artifact
120+
- name: Build
121+
run: |
122+
PACKAGE_NAME_PREFIX=${{ needs.package-name-prefix.outputs.prefix }}
123+
export PACKAGE_NAME_PREFIX
124+
task dist:${{ matrix.os.task }}
125+
126+
# Transfer builds to artifacts job
127+
- name: Upload build artifact
124128
uses: actions/upload-artifact@v3
125129
with:
126-
path: ${{ env.BUILDS_ARTIFACT }}/${{ matrix.artifact.path }}
127-
name: ${{ matrix.artifact.name }}
130+
path: ${{ env.DIST_DIR }}/${{ matrix.os.path }}
131+
name: ${{ matrix.os.name }}
128132

129-
clean:
130-
needs: artifacts
133+
checksums:
134+
needs:
135+
- build
136+
- package-name-prefix
131137
runs-on: ubuntu-latest
132138

133139
steps:
134-
- name: Remove unneeded combined builds artifact
135-
uses: geekyeggo/delete-artifact@v1
140+
- name: Download build artifacts
141+
uses: actions/download-artifact@v3
142+
143+
- name: Create checksum file
144+
run: |
145+
TAG="${{ needs.package-name-prefix.outputs.prefix }}git-snapshot"
146+
declare -a artifacts=($(ls -d */))
147+
for artifact in ${artifacts[@]}
148+
do
149+
cd $artifact
150+
checksum=$(sha256sum ${{ env.PROJECT_NAME }}_${TAG}*)
151+
cd ..
152+
echo $checksum >> ${TAG}-checksums.txt
153+
done
154+
155+
- name: Upload checksum artifact
156+
uses: actions/upload-artifact@v3
136157
with:
137-
name: ${{ env.BUILDS_ARTIFACT }}
158+
path: ./*checksums.txt
159+
name: checksums

workflow-templates/dependabot/workflow-template-copies/.github/workflows/release-go-task.yml

+22-17
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,28 @@ jobs:
1919
create-release-artifacts:
2020
runs-on: ubuntu-latest
2121

22+
strategy:
23+
matrix:
24+
os:
25+
- Windows_32bit
26+
- Windows_64bit
27+
- Linux_32bit
28+
- Linux_64bit
29+
- Linux_ARMv6
30+
- Linux_ARMv7
31+
- Linux_ARM64
32+
- macOS_64bit
33+
- macOS_ARM64
34+
2235
steps:
2336
- name: Checkout repository
2437
uses: actions/checkout@v3
2538
with:
2639
fetch-depth: 0
2740

2841
- name: Create changelog
42+
# Avoid creating the same changelog for each os
43+
if: matrix.os == 'Windows_32bit'
2944
uses: arduino/create-changelog@v1
3045
with:
3146
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -132,14 +147,10 @@ jobs:
132147
run: |
133148
gon "${{ env.GON_CONFIG_PATH }}"
134149
135-
- name: Re-package binary and output checksum
150+
- name: Re-package binary
136151
id: re-package
137152
working-directory: ${{ env.DIST_DIR }}
138-
# This step performs the following:
139-
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
140-
# 2. Recalculate package checksum
141-
# 3. Output the new checksum to include in the nnnnnn-checksums.txt file
142-
# (it cannot be done there because of workflow job parallelization)
153+
# Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
143154
run: |
144155
# GitHub's upload/download-artifact actions don't preserve file permissions,
145156
# so we need to add execution permission back until the action is made to do this.
@@ -149,11 +160,9 @@ jobs:
149160
tar -czvf "$PACKAGE_FILENAME" \
150161
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
151162
-C ../../ LICENSE.txt
152-
CHECKSUM_LINE="$(shasum -a 256 $PACKAGE_FILENAME)"
153163
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
154-
echo "::set-output name=checksum-${{ matrix.artifact.name }}::$CHECKSUM_LINE"
155164
156-
- name: Upload artifacts
165+
- name: Upload artifact
157166
uses: actions/upload-artifact@v3
158167
with:
159168
if-no-files-found: error
@@ -171,15 +180,11 @@ jobs:
171180
name: ${{ env.ARTIFACT_NAME }}
172181
path: ${{ env.DIST_DIR }}
173182

174-
- name: Update checksum
183+
- name: Create checksum file
184+
working-directory: ${{ env.DIST_DIR}}
175185
run: |
176-
declare -a checksum_lines=("${{ needs.notarize-macos.outputs.checksum-darwin_amd64 }}" "${{ needs.notarize-macos.outputs.checksum-darwin_arm64 }}")
177-
for checksum_line in "${checksum_lines[@]}"
178-
do
179-
CHECKSUM=$(echo ${checksum_line} | cut -d " " -f 1)
180-
PACKAGE_FILENAME=$(echo ${checksum_line} | cut -d " " -f 2)
181-
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CHECKSUM} ${PACKAGE_FILENAME}/g;" ${{ env.DIST_DIR }}/*-checksums.txt
182-
done
186+
TAG="${GITHUB_REF/refs\/tags\//}"
187+
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* > ${TAG}-checksums.txt
183188
184189
- name: Identify Prerelease
185190
# This is a workaround while waiting for create-release action

0 commit comments

Comments
 (0)