24
24
repository_dispatch :
25
25
26
26
env :
27
+ # As defined by the Taskfile's PROJECT_NAME variable
28
+ PROJECT_NAME : TODO_PROJECT_NAME
27
29
# As defined by the Taskfile's DIST_DIR variable
28
30
DIST_DIR : dist
29
- BUILDS_ARTIFACT : build-artifacts
30
31
31
32
jobs :
32
33
run-determination :
@@ -52,86 +53,107 @@ jobs:
52
53
53
54
echo "::set-output name=result::$RESULT"
54
55
55
- build :
56
+ package-name-prefix :
56
57
needs : run-determination
57
58
if : needs.run-determination.outputs.result == 'true'
58
59
runs-on : ubuntu-latest
59
-
60
+ outputs :
61
+ prefix : ${{ steps.calculation.outputs.prefix }}
60
62
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
71
65
run : |
72
66
PACKAGE_NAME_PREFIX="test"
73
67
if [ "${{ github.event_name }}" = "pull_request" ]; then
74
68
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
75
69
fi
76
70
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
77
- export PACKAGE_NAME_PREFIX
78
- task dist:all
79
71
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"
86
73
87
- artifacts :
88
- name : ${{ matrix.artifact. name }} artifact
89
- needs : build
74
+ build :
75
+ needs : package- name-prefix
76
+ name : Build ${{ matrix.os.name }}
90
77
runs-on : ubuntu-latest
91
78
92
79
strategy :
93
80
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"
98
90
name : Linux_X86-32
99
- - path : " *Linux_64bit.tar.gz"
91
+ - task : Linux_64bit
92
+ path : " *Linux_64bit.tar.gz"
100
93
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"
104
96
name : Linux_ARMv6
105
- - path : " *Linux_ARMv7.tar.gz"
97
+ - task : Linux_ARMv7
98
+ path : " *Linux_ARMv7.tar.gz"
106
99
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"
108
105
name : macOS_64
109
- - path : " *macOS_ARM64.tar.gz"
106
+ - task : macOS_ARM64
107
+ path : " *macOS_ARM64.tar.gz"
110
108
name : macOS_ARM64
111
- - path : " *Windows_32bit.zip"
112
- name : Windows_X86-32
113
- - path : " *Windows_64bit.zip"
114
- name : Windows_X86-64
115
109
116
110
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
119
116
with :
120
- name : ${{ env.BUILDS_ARTIFACT }}
121
- path : ${{ env.BUILDS_ARTIFACT }}
117
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
118
+ version : 3.x
122
119
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
124
128
uses : actions/upload-artifact@v3
125
129
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 }}
128
132
129
- clean :
130
- needs : artifacts
133
+ checksums :
134
+ needs :
135
+ - build
136
+ - package-name-prefix
131
137
runs-on : ubuntu-latest
132
138
133
139
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
136
157
with :
137
- name : ${{ env.BUILDS_ARTIFACT }}
158
+ path : ./*checksums.txt
159
+ name : checksums
0 commit comments