Skip to content

Commit b7d561a

Browse files
authored
Merge pull request #222 from per1234/update-release-system
Sync release assets from template
2 parents 02431da + 4bf9bf4 commit b7d561a

17 files changed

+433
-476
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Check Go
33

44
env:
55
# See: https://github.com/actions/setup-go/tree/v2#readme
6-
GO_VERSION: "1.14"
6+
GO_VERSION: "1.16"
77

88
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
99
on:
@@ -88,6 +88,9 @@ jobs:
8888
repo-token: ${{ secrets.GITHUB_TOKEN }}
8989
version: 3.x
9090

91+
- name: Install golint
92+
run: go install golang.org/x/lint/golint@latest
93+
9194
- name: Check style
9295
run: task --silent go:lint
9396

Diff for: .github/workflows/nightly.yml

-134
This file was deleted.

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

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/publish-go-nightly-task.md
2+
name: Publish Nightly Build
3+
4+
env:
5+
# As defined by the Taskfile's PROJECT_NAME variable
6+
PROJECT_NAME: arduino-lint
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-lint/
11+
ARTIFACT_NAME: dist
12+
13+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
14+
on:
15+
schedule:
16+
# run every day at 1AM
17+
- cron: "0 1 * * *"
18+
workflow_dispatch:
19+
repository_dispatch:
20+
21+
jobs:
22+
create-nightly-artifacts:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
29+
- name: Install Taskfile
30+
uses: arduino/setup-task@v1
31+
with:
32+
repo-token: ${{ secrets.GITHUB_TOKEN }}
33+
version: 3.x
34+
35+
- name: Build
36+
env:
37+
NIGHTLY: true
38+
run: task dist:all
39+
40+
- name: Upload artifacts
41+
uses: actions/upload-artifact@v2
42+
with:
43+
if-no-files-found: error
44+
name: ${{ env.ARTIFACT_NAME }}
45+
path: ${{ env.DIST_DIR }}
46+
47+
notarize-macos:
48+
runs-on: macos-latest
49+
needs: create-nightly-artifacts
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v2
54+
55+
- name: Download artifacts
56+
uses: actions/download-artifact@v2
57+
with:
58+
name: ${{ env.ARTIFACT_NAME }}
59+
path: ${{ env.DIST_DIR }}
60+
61+
- name: Import Code-Signing Certificates
62+
env:
63+
KEYCHAIN: "sign.keychain"
64+
INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12"
65+
KEYCHAIN_PASSWORD: keychainpassword # Arbitrary password for a keychain that exists only for the duration of the job, so not secret
66+
run: |
67+
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}"
68+
security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
69+
security default-keychain -s "${{ env.KEYCHAIN }}"
70+
security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
71+
security import \
72+
"${{ env.INSTALLER_CERT_MAC_PATH }}" \
73+
-k "${{ env.KEYCHAIN }}" \
74+
-f pkcs12 \
75+
-A \
76+
-T /usr/bin/codesign \
77+
-P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
78+
security set-key-partition-list \
79+
-S apple-tool:,apple: \
80+
-s \
81+
-k "${{ env.KEYCHAIN_PASSWORD }}" \
82+
"${{ env.KEYCHAIN }}"
83+
84+
- name: Install gon for code signing and app notarization
85+
run: |
86+
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip
87+
unzip gon_macos.zip -d /usr/local/bin
88+
89+
- name: Sign and notarize binary
90+
env:
91+
AC_USERNAME: ${{ secrets.AC_USERNAME }}
92+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
93+
run: |
94+
gon gon.config.hcl
95+
96+
- name: Re-package binary and update checksum
97+
# This step performs the following:
98+
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
99+
# 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
100+
run: |
101+
# GitHub's upload/download-artifact@v2 actions don't preserve file permissions,
102+
# so we need to add execution permission back until the action is made to do this.
103+
chmod +x "${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_amd64/${{ env.PROJECT_NAME }}"
104+
PACKAGE_FILENAME="$(basename ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_nightly-*_macOS_64bit.tar.gz)"
105+
tar -czvf "${{ env.DIST_DIR }}/$PACKAGE_FILENAME" \
106+
-C "${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_amd64/" "${{ env.PROJECT_NAME }}" \
107+
-C ../../ LICENSE.txt
108+
CHECKSUM="$(shasum -a 256 ${{ env.DIST_DIR }}/$PACKAGE_FILENAME | cut -d " " -f 1)"
109+
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CHECKSUM} ${PACKAGE_FILENAME}/g;" ${{ env.DIST_DIR }}/*-checksums.txt
110+
111+
- name: Upload artifacts
112+
uses: actions/upload-artifact@v2
113+
with:
114+
if-no-files-found: error
115+
name: ${{ env.ARTIFACT_NAME }}
116+
path: ${{ env.DIST_DIR }}
117+
118+
publish-nightly:
119+
runs-on: ubuntu-latest
120+
needs: notarize-macos
121+
122+
steps:
123+
- name: Download artifact
124+
uses: actions/download-artifact@v2
125+
with:
126+
name: ${{ env.ARTIFACT_NAME }}
127+
path: ${{ env.DIST_DIR }}
128+
129+
- name: Upload release files on Arduino downloads servers
130+
uses: docker://plugins/s3
131+
env:
132+
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
133+
PLUGIN_TARGET: "${{ env.AWS_PLUGIN_TARGET }}nightly"
134+
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
135+
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
136+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
137+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
138+
139+
report:
140+
runs-on: ubuntu-latest
141+
needs: publish-nightly
142+
if: failure() # Run if publish-nightly or any of its job dependencies failed
143+
144+
steps:
145+
- name: Report failure
146+
uses: masci/datadog@v1
147+
with:
148+
api-key: ${{ secrets.DD_API_KEY }}
149+
events: |
150+
- title: "${{ env.PROJECT_NAME }} nightly build failed"
151+
text: "Nightly build workflow has failed"
152+
alert_type: "error"
153+
host: ${{ github.repository }}
154+
tags:
155+
- "project:${{ env.PROJECT_NAME }}"
156+
- "workflow:${{ github.workflow }}"

0 commit comments

Comments
 (0)