File tree Expand file tree Collapse file tree 2 files changed +64
-2
lines changed Expand file tree Collapse file tree 2 files changed +64
-2
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,26 @@ jobs:
99
99
run : npm run check-vsix-size
100
100
shell : bash
101
101
102
+ - name : Sign .vsix
103
+ if : runner.os == 'Linux'
104
+ env :
105
+ ARTIFACTORY_HOST : ${{ secrets.ARTIFACTORY_HOST }}
106
+ ARTIFACTORY_PASSWORD : ${{ secrets.ARTIFACTORY_PASSWORD }}
107
+ ARTIFACTORY_USERNAME : ${{ secrets.ARTIFACTORY_USERNAME }}
108
+ GARASIGN_PASSWORD : ${{ secrets.GARASIGN_PASSWORD }}
109
+ GARASIGN_USERNAME : ${{ secrets.GARASIGN_USERNAME }}
110
+ run : |
111
+ bash scripts/sign-vsix.sh
112
+ ls *.vsix.sig
113
+ shell : bash
114
+
102
115
- name : Upload artifacts
103
116
uses : actions/upload-artifact@v2
104
117
with :
105
118
name : VSIX built on ${{ runner.os }}
106
- path : " *.vsix"
119
+ path : |
120
+ *.vsix
121
+ *.vsix.sig
107
122
108
123
- name : Run Snyk Test
109
124
if : runner.os == 'Linux'
@@ -149,7 +164,9 @@ jobs:
149
164
--notes "Edit the release notes before publishing." \
150
165
--target main \
151
166
--draft \
152
- *.vsix
167
+ *.vsix \
168
+ *.vsix.sig
169
+
153
170
env :
154
171
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
155
172
if : ${{ startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' }}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ FILE_TO_SIGN=$( find . -maxdepth 1 -name ' *.vsix' -print -quit)
4
+
5
+ if [ -z " $FILE_TO_SIGN " ]; then
6
+ echo " Error: No .vsix file found in the current directory." >&2
7
+ exit 1
8
+ fi
9
+
10
+ required_vars=(" ARTIFACTORY_PASSWORD" " ARTIFACTORY_HOST" " ARTIFACTORY_USERNAME" " GARASIGN_USERNAME" " GARASIGN_PASSWORD" )
11
+ for var in " ${required_vars[@]} " ; do
12
+ if [ -z " ${! var} " ]; then
13
+ echo " Error: Environment variable $var is not set." >&2
14
+ exit 1
15
+ fi
16
+ done
17
+
18
+ logout_artifactory () {
19
+ docker logout " ${ARTIFACTORY_HOST} " > /dev/null 2>&1
20
+ echo " logged out from artifactory"
21
+ }
22
+
23
+ trap logout_artifactory EXIT
24
+
25
+
26
+ echo " ${ARTIFACTORY_PASSWORD} " | docker login " ${ARTIFACTORY_HOST} " -u " ${ARTIFACTORY_USERNAME} " --password-stdin > /dev/null 2>&1
27
+
28
+ if [ $? -ne 0 ]; then
29
+ echo " Docker login failed" >&2
30
+ exit 1
31
+ fi
32
+
33
+ docker run \
34
+ --rm \
35
+ -e GRS_CONFIG_USER1_USERNAME=" ${GARASIGN_USERNAME} " \
36
+ -e GRS_CONFIG_USER1_PASSWORD=" ${GARASIGN_PASSWORD} " \
37
+ -v " $( pwd) :/tmp/workdir" \
38
+ -w /tmp/workdir \
39
+ ${ARTIFACTORY_HOST} /release-tools-container-registry-local/garasign-gpg \
40
+ /bin/bash -c " gpgloader && gpg --yes -v --armor -o /tmp/workdir/${FILE_TO_SIGN} .sig --detach-sign /tmp/workdir/${FILE_TO_SIGN} "
41
+
42
+ if [ $? -ne 0 ]; then
43
+ echo " Signing failed" >&2
44
+ exit 1
45
+ fi
You can’t perform that action at this time.
0 commit comments