1
- name : release
1
+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/release-go-task.md
2
+ name : Release
3
+
4
+ env :
5
+ # As defined by the Taskfile's PROJECT_NAME variable
6
+ PROJECT_NAME : arduino-cli
7
+ # As defined by the Taskfile's DIST_DIR variable
8
+ DIST_DIR : dist
9
+ # The project's folder on Arduino's download server for uploading builds
10
+ AWS_PLUGIN_TARGET : /arduino-cli/
11
+ ARTIFACT_NAME : dist
2
12
3
13
on :
4
14
push :
10
20
runs-on : ubuntu-latest
11
21
12
22
steps :
13
- - name : Checkout
14
- uses : actions/checkout@v1
23
+ - name : Checkout repository
24
+ uses : actions/checkout@v2
15
25
with :
16
26
fetch-depth : 0
17
27
21
31
tag-regex : ' ^[0-9]+\.[0-9]+\.[0-9]+.*$'
22
32
filter-regex : ' ^\[(skip|changelog)[ ,-](skip|changelog)\].*'
23
33
case-insensitive-regex : true
24
- changelog-file-path : " dist /CHANGELOG.md"
34
+ changelog-file-path : " ${{ env.DIST_DIR }} /CHANGELOG.md"
25
35
26
- - name : Install Taskfile
36
+ - name : Install Task
27
37
uses : arduino/setup-task@v1
28
38
with :
29
39
repo-token : ${{ secrets.GITHUB_TOKEN }}
@@ -35,35 +45,46 @@ jobs:
35
45
- name : Upload artifacts
36
46
uses : actions/upload-artifact@v2
37
47
with :
38
- name : dist
39
- path : dist
48
+ if-no-files-found : error
49
+ name : ${{ env.ARTIFACT_NAME }}
50
+ path : ${{ env.DIST_DIR }}
40
51
41
52
notarize-macos :
42
53
runs-on : macos-latest
43
54
needs : create-release-artifacts
44
55
45
56
steps :
46
- - name : Checkout
57
+ - name : Checkout repository
47
58
uses : actions/checkout@v2
48
59
49
60
- name : Download artifacts
50
61
uses : actions/download-artifact@v2
51
62
with :
52
- name : dist
53
- # to ensure compatibility with v1
54
- path : dist
63
+ name : ${{ env.ARTIFACT_NAME }}
64
+ path : ${{ env.DIST_DIR }}
55
65
56
66
- name : Import Code-Signing Certificates
57
67
env :
58
68
KEYCHAIN : " sign.keychain"
59
69
INSTALLER_CERT_MAC_PATH : " /tmp/ArduinoCerts2020.p12"
70
+ KEYCHAIN_PASSWORD : keychainpassword # Arbitrary password for a keychain that exists only for the duration of the job, so not secret
60
71
run : |
61
72
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}"
62
- security create-keychain -p "${{ secrets .KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
73
+ security create-keychain -p "${{ env .KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
63
74
security default-keychain -s "${{ env.KEYCHAIN }}"
64
- security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
65
- security import "${{ env.INSTALLER_CERT_MAC_PATH }}" -k "${{ env.KEYCHAIN }}" -f pkcs12 -A -T /usr/bin/codesign -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
66
- security set-key-partition-list -S apple-tool:,apple: -s -k "${{ secrets.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
75
+ security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
76
+ security import \
77
+ "${{ env.INSTALLER_CERT_MAC_PATH }}" \
78
+ -k "${{ env.KEYCHAIN }}" \
79
+ -f pkcs12 \
80
+ -A \
81
+ -T "/usr/bin/codesign" \
82
+ -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
83
+ security set-key-partition-list \
84
+ -S apple-tool:,apple: \
85
+ -s \
86
+ -k "${{ env.KEYCHAIN_PASSWORD }}" \
87
+ "${{ env.KEYCHAIN }}"
67
88
68
89
- name : Install gon for code signing and app notarization
69
90
run : |
@@ -82,46 +103,33 @@ jobs:
82
103
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
83
104
# 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
84
105
run : |
85
- # GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
86
- # so we need to add execution permission back until @v2 actions are released .
87
- chmod +x dist/arduino-cli_osx_darwin_amd64/arduino-cli
106
+ # GitHub's upload/download-artifact@v2 actions don't preserve file permissions,
107
+ # so we need to add execution permission back until the action is made to do this .
108
+ chmod +x ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_amd64/${{ env.PROJECT_NAME }}
88
109
TAG="${GITHUB_REF/refs\/tags\//}"
89
- tar -czvf "dist/arduino-cli_ ${TAG}_macOS_64bit.tar.gz" \
90
- -C dist/arduino-cli_osx_darwin_amd64 / arduino-cli \
110
+ tar -czvf "${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_ ${TAG}_macOS_64bit.tar.gz" \
111
+ -C ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_amd64 / ${{ env.PROJECT_NAME }} \
91
112
-C ../../ LICENSE.txt
92
- CLI_CHECKSUM ="$(shasum -a 256 "dist/arduino-cli_${ TAG}_macOS_64bit.tar.gz" | cut -d " " -f 1)"
93
- perl -pi -w -e "s/.*arduino-cli_${ TAG}_macOS_64bit.tar.gz/${CLI_CHECKSUM } arduino-cli_${ TAG}_macOS_64bit.tar.gz/g;" dist /*-checksums.txt
113
+ CHECKSUM ="$(shasum -a 256 ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_${ TAG}_macOS_64bit.tar.gz | cut -d " " -f 1)"
114
+ perl -pi -w -e "s/.*${{ env.PROJECT_NAME }}_${ TAG}_macOS_64bit.tar.gz/${CHECKSUM } ${{ env.PROJECT_NAME }}_${ TAG}_macOS_64bit.tar.gz/g;" ${{ env.DIST_DIR }} /*-checksums.txt
94
115
95
116
- name : Upload artifacts
96
117
uses : actions/upload-artifact@v2
97
118
with :
98
- name : dist
99
- path : dist
119
+ if-no-files-found : error
120
+ name : ${{ env.ARTIFACT_NAME }}
121
+ path : ${{ env.DIST_DIR }}
100
122
101
123
create-release :
102
124
runs-on : ubuntu-latest
103
125
needs : notarize-macos
104
126
105
127
steps :
106
- - name : Checkout
107
- uses : actions/checkout@v2
108
-
109
128
- name : Download artifact
110
129
uses : actions/download-artifact@v2
111
130
with :
112
- name : dist
113
- # to ensure compatibility with v1
114
- path : dist
115
-
116
- - name : Read CHANGELOG
117
- id : changelog
118
- run : |
119
- body="$(cat dist/CHANGELOG.md)"
120
- body="${body//'%'/'%25'}"
121
- body="${body//$'\n'/'%0A'}"
122
- body="${body//$'\r'/'%0D'}"
123
- echo "$body"
124
- echo "::set-output name=BODY::$body"
131
+ name : ${{ env.ARTIFACT_NAME }}
132
+ path : ${{ env.DIST_DIR }}
125
133
126
134
- name : Identify Prerelease
127
135
# This is a workaround while waiting for create-release action
@@ -132,32 +140,23 @@ jobs:
132
140
unzip -p /tmp/3.0.0.zip semver-tool-3.0.0/src/semver >/tmp/semver && chmod +x /tmp/semver
133
141
if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "::set-output name=IS_PRE::true"; fi
134
142
135
- - name : Create Github Release
136
- id : create_release
137
- uses : actions/create-release@v1
138
- env :
139
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143
+ - name : Create Github Release and upload artifacts
144
+ uses : ncipollo/release-action@v1
140
145
with :
141
- tag_name : ${{ github.ref }}
142
- release_name : ${{ github.ref }}
143
- body : ${{ steps.changelog.outputs.BODY }}
146
+ token : ${{ secrets.GITHUB_TOKEN }}
147
+ bodyFile : ${{ env.DIST_DIR }}/CHANGELOG.md
144
148
draft : false
145
149
prerelease : ${{ steps.prerelease.outputs.IS_PRE }}
146
-
147
- - name : Upload release files on Github
148
- uses : svenstaro/upload-release-action@v2
149
- with :
150
- repo_token : ${{ secrets.GITHUB_TOKEN }}
151
- file : dist/*
152
- tag : ${{ github.ref }}
153
- file_glob : true
150
+ # NOTE: "Artifact is a directory" warnings are expected and don't indicate a problem
151
+ # (all the files we need are in the DIST_DIR root)
152
+ artifacts : ${{ env.DIST_DIR }}/*
154
153
155
154
- name : Upload release files on Arduino downloads servers
156
155
uses : docker://plugins/s3
157
156
env :
158
- PLUGIN_SOURCE : " dist /*"
159
- PLUGIN_TARGET : " /arduino-cli/ "
160
- PLUGIN_STRIP_PREFIX : " dist /"
157
+ PLUGIN_SOURCE : " ${{ env.DIST_DIR }} /*"
158
+ PLUGIN_TARGET : ${{ env.AWS_PLUGIN_TARGET }}
159
+ PLUGIN_STRIP_PREFIX : " ${{ env.DIST_DIR }} /"
161
160
PLUGIN_BUCKET : ${{ secrets.DOWNLOADS_BUCKET }}
162
161
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
163
162
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
0 commit comments