6
6
- ' [0-9].[0-9].[0-9]*'
7
7
8
8
jobs :
9
- publish-release :
9
+
10
+ create-release-artifacts :
10
11
runs-on : ubuntu-latest
11
12
12
13
container :
@@ -16,13 +17,121 @@ jobs:
16
17
- $PWD/go:/go
17
18
18
19
steps :
19
- - name : checkout
20
+ - name : Checkout
20
21
uses : actions/checkout@v1
21
22
22
- - name : build
23
+ - name : Build
24
+ run : goreleaser
25
+
26
+ - name : Upload artifacts
27
+ uses : actions/upload-artifact@v1
28
+ with :
29
+ name : dist
30
+ path : dist
31
+
32
+ notarize-macos :
33
+ runs-on : macos-latest
34
+ needs : create-release-artifacts
35
+
36
+ steps :
37
+ - name : Checkout
38
+ uses : actions/checkout@v1
39
+
40
+ - name : Download artifacts
41
+ uses : actions/download-artifact@v1
42
+ with :
43
+ name : dist
44
+
45
+ - name : Get the current release tag
46
+ id : get_tag
47
+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
48
+
49
+ - name : Download Gon
50
+ run : |
51
+ wget -q https://github.com/mitchellh/gon/releases/download/v0.2.2/gon_0.2.2_macos.zip
52
+ unzip gon_0.2.2_macos.zip -d /usr/local/bin
53
+ rm -f gon_0.2.2_macos.zip
54
+
55
+ - name : Notarize binary, re-package it and update checksum
23
56
env :
24
- GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
57
+ TAG : ${{ steps.get_tag.outputs.VERSION }}
58
+ AC_USERNAME : ${{ secrets.AC_USERNAME }}
59
+ AC_PASSWORD : ${{ secrets.AC_PASSWORD }}
60
+ # This step performs the following:
61
+ # 1. Download keychain from GH secrets and decode it from base64
62
+ # 2. Add the keychain to the system keychains and unlock it
63
+ # 3. Call Gon to start notarization process (using AC_USERNAME and AC_PASSWORD)
64
+ # 4. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
65
+ # 5. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
66
+ run : |
67
+ echo "${{ secrets.KEYCHAIN }}" | base64 --decode > ~/Library/Keychains/apple-developer.keychain-db
68
+ security list-keychains -s ~/Library/Keychains/apple-developer.keychain-db
69
+ security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" ~/Library/Keychains/apple-developer.keychain-db
70
+ gon gon.config.hcl
71
+ # GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
72
+ # so we need to add execution permission back until @v2 actions are released.
73
+ chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli
74
+ tar -czvf dist/arduino-cli_${TAG}_macOS_64bit.tar.gz \
75
+ -C dist/arduino_cli_osx_darwin_amd64/ arduino-cli \
76
+ -C ../../ LICENSE.txt
77
+ CLI_CHECKSUM=$(shasum -a 256 dist/arduino-cli_${TAG}_macOS_64bit.tar.gz | cut -d " " -f 1)
78
+ 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
79
+
80
+ - name : Upload artifacts
81
+ uses : actions/upload-artifact@v1
82
+ with :
83
+ name : dist
84
+ path : dist
85
+
86
+ create-release :
87
+ runs-on : ubuntu-latest
88
+ needs : notarize-macos
89
+
90
+ steps :
91
+ - name : Checkout
92
+ uses : actions/checkout@v1
93
+
94
+ - name : Download artifact
95
+ uses : actions/download-artifact@v1
96
+ with :
97
+ name : dist
98
+
99
+ - name : Read CHANGELOG
100
+ id : changelog
101
+ run : |
102
+ body=$(cat dist/CHANGELOG.md)
103
+ body="${body//'%'/'%25'}"
104
+ body="${body//$'\n'/'%0A'}"
105
+ body="${body//$'\r'/'%0D'}"
106
+ echo $body
107
+ echo "::set-output name=BODY::$body"
108
+
109
+ - name : Create Github Release
110
+ id : create_release
111
+ uses : actions/create-release@master
112
+ env :
113
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
114
+ with :
115
+ tag_name : ${{ github.ref }}
116
+ release_name : ${{ github.ref }}
117
+ body : ${{ steps.changelog.outputs.BODY }}
118
+ draft : false
119
+ prerelease : false
120
+
121
+ - name : Upload release files on Github
122
+ uses : svenstaro/upload-release-action@v1-release
123
+ with :
124
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
125
+ file : dist/*
126
+ tag : ${{ github.ref }}
127
+ file_glob : true
128
+
129
+ - name : Upload release files on Arduino downloads servers
130
+ uses : docker://plugins/s3
131
+ env :
132
+ PLUGIN_SOURCE : ' dist/*'
133
+ PLUGIN_TARGET : ' /arduino-cli/'
134
+ PLUGIN_STRIP_PREFIX : ' dist/'
135
+ PLUGIN_BUCKET : ${{ secrets.DOWNLOADS_BUCKET }}
25
136
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
26
137
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27
- AWS_DEFAULT_REGION : ' us-east-1'
28
- run : goreleaser
0 commit comments