-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (93 loc) · 3.7 KB
/
publish-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: publish-test
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
publish-test:
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: publish-extension
env:
PUBLISHER_NAME: ${{ secrets.PUBLISHER_NAME }}
ORG_NAME: ${{ secrets.ORG_NAME }}
USER_TOKEN: ${{ secrets.USER_TOKEN }}
MAJOR: 1
MINOR: 0
PATCH: $[counter($MINOR, 0)]
VERSION: $MAJOR.$MINOR.$PATCH
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}
run: |
name="Synopsys-security-scan"
echo $name
echo $[counter(1, 0)]
npx semantic-release
echo "EXTENSION_NAME=$name" >> build.env
vss_extension=$(cat vss-extension-dev.json)
vss_extension=$(echo $vss_extension | jq ".id = \"$name\"")
vss_extension=$(echo $vss_extension | jq ".name = \"$name\"")
azure_extension_version=$(echo $vss_extension | jq -r '.version')
echo "AZURE_EXTENSION_VERSION=$azure_extension_version" >> build.env
echo $azure_extension_version
major=$(echo $azure_extension_version | awk -F. '{print $1}')
minor=$(echo $azure_extension_version | awk -F. '{print $2}')
patch=$(echo $azure_extension_version | awk -F. '{print $3}')
echo $major
echo $minor
echo $patch
rm vss-extension-dev.json
echo $vss_extension > vss-extension-dev.json
echo $vss_extension > vss-extension.json
cat vss-extension-dev.json
cat vss-extension.json
# cd synopsys-task
# task_json=$(cat task.json)
# task_json=$(echo $task_json | jq ".name = \"$name\"")
# task_json=$(echo $task_json | jq ".id = \"$uuid\"")
# rm task.json
# npm install
# npm run all
# rm -rf node_modules
# echo $task_json > task.json
# cat task.json
# cd ..
# npm i -g tfx-cli
# tfx extension publish --publisher TestCIPub --rev-version --manifest-globs vss-extension-dev.json --token ${USER_TOKEN}
# - name: Install dependencies
# run: cd synopsys-task && npm ci
# - name: Unit Test Cases
# id: unit-test-cases
# shell: bash
# run: |
# cd synopsys-task && npm run test
# coverageFile="coverage/index.html"
# ### fetching line coverage from coverage/index.html file
# coverageSpan=$(grep -B 1 '<span class="quiet">Lines</span>' $coverageFile | head -n 1)
# coverageHtml=$(echo "$coverageSpan" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
# coverageInPercent=$(echo $coverageHtml | sed -n 's/.*<span class="strong">\([0-9.]*%\).*/\1/p' | tr -d ' ')
# echo "Line Coverage: $coverageInPercent"
# ### remove percentage sign from coverageInPercent and convert to a floatin-point number
# coverageValue=$(echo "$coverageInPercent" | tr -d '%' | sed 's/,/./g')
# ### check if the coverage is below 90%
# if [[ $coverageValue < 90 ]]; then
# echo "##[error]Line coverage is below 90%"
# exit 1
# fi