Skip to content

Commit c7b4c36

Browse files
mirkoCrobumirkoCrobu
authored andcommitted
fix merge conflicts
2 parents fe13dcd + 39e0e5d commit c7b4c36

File tree

376 files changed

+4773
-1478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+4773
-1478
lines changed

.github/workflows/go-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88

99
env:
10-
GO_VERSION: "1.25.0"
10+
GO_VERSION: "1.25.1"
1111

1212
jobs:
1313
go-test-orchestrator:

.github/workflows/openapi-spec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
required: false
1313
default: "main"
1414
env:
15-
GO_VERSION: "1.25.0"
15+
GO_VERSION: "1.25.1"
1616

1717
jobs:
1818
oasdiff:
Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
name: Release Arduino Flasher tool
2+
3+
on:
4+
push:
5+
tags:
6+
- "flasher-*" # Trigger on all tags
7+
8+
env:
9+
GO_VERSION: "1.25.1"
10+
PROJECT_NAME: "arduino-flasher-cli"
11+
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
12+
GITHUB_USERNAME: ArduinoBot
13+
DIST_DIR: build
14+
15+
jobs:
16+
build:
17+
strategy:
18+
matrix:
19+
os: [ubuntu-22.04, macos-13, windows-2022]
20+
arch: [amd64, arm64]
21+
exclude:
22+
- os: windows-2022
23+
arch: arm64
24+
runs-on: ${{ matrix.os }}
25+
outputs:
26+
release: ${{ steps.set-version.outputs.RELEASE_NAME }}
27+
defaults:
28+
run:
29+
shell: bash
30+
steps:
31+
- name: Extract version
32+
run: |
33+
TAG_NAME="${GITHUB_REF##*/}"
34+
VERSION="${TAG_NAME#flasher-}" # Remove 'flasher-' prefix
35+
echo "RELEASE_NAME=${{ env.PROJECT_NAME }}-${VERSION}-${{ matrix.os }}-${{ matrix.arch }}" >> $GITHUB_ENV
36+
env:
37+
GITHUB_REF: ${{ github.ref }}
38+
39+
- name: Set Windows version
40+
id: set-version
41+
run: |
42+
echo "RELEASE_NAME=${{ env.RELEASE_NAME }}" >> $GITHUB_OUTPUT
43+
if: matrix.os == 'windows-2022'
44+
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Set up Go
51+
uses: actions/setup-go@v5
52+
with:
53+
go-version: ${{ env.GO_VERSION }}
54+
55+
- name: Install Taskfile
56+
uses: arduino/setup-task@v2
57+
with:
58+
version: "3.x"
59+
repo-token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Configure Git for private repo cloning
62+
run: |
63+
git config --global url."https://${{ env.GITHUB_USERNAME }}:${{ env.GITHUB_TOKEN }}@github.com".insteadOf "https://github.com"
64+
65+
- name: Build Binary
66+
run: |
67+
task arduino-flasher-cli:build
68+
69+
- name: Prepare Build Artifacts
70+
working-directory: ./${{ env.DIST_DIR }}
71+
run: |
72+
tar -czf ${{ env.RELEASE_NAME }}.tar.gz arduino-flasher-cli*
73+
74+
- name: Upload artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: ${{ env.PROJECT_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
78+
path: |
79+
${{ env.DIST_DIR }}/${{ env.RELEASE_NAME }}.tar.gz
80+
if-no-files-found: error
81+
82+
sign-windows-executable:
83+
runs-on: windows-sign-pc
84+
needs: build
85+
86+
defaults:
87+
run:
88+
shell: bash
89+
90+
env:
91+
INSTALLER_CERT_WINDOWS_CER: "/tmp/cert.cer"
92+
# We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
93+
# Keep in mind that this path could change when upgrading to a new runner version
94+
SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
95+
RELEASE_NAME: ${{ needs.build.outputs.release }}
96+
97+
steps:
98+
- name: Download artifacts
99+
uses: actions/download-artifact@v5
100+
with:
101+
name: ${{ env.PROJECT_NAME }}-windows-2022-amd64
102+
103+
- name: Save Win signing certificate to file
104+
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_CER }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER}}
105+
106+
- name: Extract build
107+
run: |
108+
tar -xvf ${{ env.RELEASE_NAME }}.tar.gz
109+
rm ${{ env.RELEASE_NAME }}.tar.gz
110+
111+
- name: Sign executable
112+
env:
113+
CERT_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
114+
CONTAINER_NAME: ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
115+
# https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
116+
run: |
117+
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino Flasher CLI" -f ${{ env.INSTALLER_CERT_WINDOWS_CER}} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v "arduino-flasher-cli.exe"
118+
119+
- name: Prepare Build Artifacts
120+
run: |
121+
tar -czf ${{ env.RELEASE_NAME }}.tar.gz arduino-flasher-cli.exe
122+
rm arduino-flasher-cli.exe
123+
124+
- name: Upload artifacts
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: ${{ env.PROJECT_NAME }}-windows-2022-amd64
128+
path: |
129+
${{ env.RELEASE_NAME }}.tar.gz
130+
if-no-files-found: error
131+
overwrite: true
132+
133+
# This step is needed because the self hosted runner does not delete files automatically
134+
- name: Cleanup
135+
run: rm ${{ env.RELEASE_NAME }}.tar.gz
136+
137+
notarize-macos:
138+
name: Notarize macOS
139+
runs-on: macos-13
140+
needs: build
141+
permissions:
142+
contents: read
143+
144+
env:
145+
GON_CONFIG_PATH: gon.config.hcl
146+
147+
strategy:
148+
matrix:
149+
build: [macos-13-amd64, macos-13-arm64]
150+
steps:
151+
- name: Set environment variables
152+
run: |
153+
TAG_NAME="${GITHUB_REF##*/}"
154+
VERSION="${TAG_NAME#flasher-}"
155+
echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}-${VERSION}-${{ matrix.build }}.tar.gz" >>$GITHUB_ENV
156+
157+
- name: Checkout repository
158+
uses: actions/checkout@v5
159+
160+
- name: Download artifacts
161+
uses: actions/download-artifact@v5
162+
with:
163+
name: ${{ env.PROJECT_NAME }}-${{ matrix.build }}
164+
path: ${{ env.DIST_DIR }}
165+
166+
- name: Extract build
167+
working-directory: ${{ env.DIST_DIR }}
168+
run: |
169+
tar -xvf ${{ env.PACKAGE_FILENAME }}
170+
171+
- name: Import Code-Signing Certificates
172+
env:
173+
KEYCHAIN: "sign.keychain"
174+
INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12"
175+
# Arbitrary password for a keychain that exists only for the duration of the job, so not secret
176+
KEYCHAIN_PASSWORD: keychainpassword
177+
run: |
178+
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode >"${{ env.INSTALLER_CERT_MAC_PATH }}"
179+
180+
security create-keychain \
181+
-p "${{ env.KEYCHAIN_PASSWORD }}" \
182+
"${{ env.KEYCHAIN }}"
183+
184+
security default-keychain \
185+
-s "${{ env.KEYCHAIN }}"
186+
187+
security unlock-keychain \
188+
-p "${{ env.KEYCHAIN_PASSWORD }}" \
189+
"${{ env.KEYCHAIN }}"
190+
191+
security import \
192+
"${{ env.INSTALLER_CERT_MAC_PATH }}" \
193+
-k "${{ env.KEYCHAIN }}" \
194+
-f pkcs12 \
195+
-A \
196+
-T "/usr/bin/codesign" \
197+
-P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
198+
199+
security set-key-partition-list \
200+
-S apple-tool:,apple: \
201+
-s \
202+
-k "${{ env.KEYCHAIN_PASSWORD }}" \
203+
"${{ env.KEYCHAIN }}"
204+
205+
- name: Install gon for code signing and app notarization
206+
run: |
207+
wget \
208+
-q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
209+
210+
unzip \
211+
gon_macos.zip \
212+
-d /usr/local/bin
213+
214+
- name: Write gon config to file
215+
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
216+
run: |
217+
cat >"${{ env.GON_CONFIG_PATH }}" \
218+
<<EOF
219+
# See: https://github.com/Bearer/gon#configuration-file
220+
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}"]
221+
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
222+
223+
sign {
224+
application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)"
225+
}
226+
227+
# Ask Gon for zip output to force notarization process to take place.
228+
# The CI will ignore the zip output, using the signed binary only.
229+
zip {
230+
output_path = "unused.zip"
231+
}
232+
EOF
233+
234+
- name: Sign and notarize binary
235+
env:
236+
AC_USERNAME: ${{ secrets.AC_USERNAME }}
237+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
238+
AC_PROVIDER: ${{ secrets.AC_PROVIDER }}
239+
run: |
240+
gon "${{ env.GON_CONFIG_PATH }}"
241+
242+
- name: Re-package binary
243+
working-directory: ${{ env.DIST_DIR }}
244+
# Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
245+
run: |
246+
# GitHub's upload/download-artifact actions don't preserve file permissions,
247+
# so we need to add execution permission back until the action is made to do this.
248+
chmod \
249+
+x \
250+
"${{ env.PROJECT_NAME }}"
251+
252+
tar -czf ${{ env.PACKAGE_FILENAME }} ${{ env.PROJECT_NAME }}
253+
254+
- name: Replace artifact with notarized build
255+
uses: actions/upload-artifact@v4
256+
with:
257+
if-no-files-found: error
258+
name: ${{ env.PROJECT_NAME }}-${{ matrix.build }}
259+
overwrite: true
260+
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}
261+
262+
create-release:
263+
runs-on: ubuntu-22.04
264+
needs: [build, sign-windows-executable, notarize-macos]
265+
steps:
266+
- name: Checkout
267+
uses: actions/checkout@v4
268+
with:
269+
fetch-depth: 0 # fetch all history for the create changelog step to work properly
270+
271+
- name: Download artifact
272+
uses: actions/download-artifact@v5
273+
with:
274+
merge-multiple: true
275+
path: ${{ env.DIST_DIR }}
276+
277+
- name: Upload artifacts index
278+
uses: ncipollo/release-action@v1
279+
with:
280+
token: ${{ secrets.GITHUB_TOKEN }}
281+
draft: false
282+
prerelease: true
283+
artifacts: ${{ env.DIST_DIR }}/*

.github/workflows/release-releaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- "releaser-*" # Trigger on all tags
77

88
env:
9-
GO_VERSION: "1.25.0"
9+
GO_VERSION: "1.25.1"
1010
PROJECT_NAME: "releaser"
1111
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
1212
GITHUB_USERNAME: ArduinoBot

.github/workflows/release-remoteocd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- "remoteocd-*" # Trigger on all tags
77

88
env:
9-
GO_VERSION: "1.25.0"
9+
GO_VERSION: "1.25.1"
1010
PROJECT_NAME: "remoteocd"
1111
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
1212
GITHUB_USERNAME: ArduinoBot

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ on:
66
- "*" # Trigger on all tags
77
- "!remoteocd-*" # Exclude remoteocd tags
88
- "!releaser-*" # Exclude releaser tags
9+
- "!flasher-*" # Exclude flasher tags
910

1011
env:
11-
GO_VERSION: "1.25.0"
12+
GO_VERSION: "1.25.1"
1213
PROJECT_NAME: "arduino-app-cli"
1314
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
1415
GITHUB_USERNAME: ArduinoBot

0 commit comments

Comments
 (0)