-
Notifications
You must be signed in to change notification settings - Fork 83
132 lines (120 loc) · 4.9 KB
/
release.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: sonar-release
# This workflow is triggered when publishing a new github release
on:
release:
types:
- published
env:
PYTHONUNBUFFERED: 1
jobs:
release:
permissions:
id-token: write
contents: write
uses: SonarSource/gh-action_release/.github/workflows/main.yaml@v5
with:
publishToBinaries: false
mavenCentralSync: false
slackChannel: team-sonarlint-vscode
deploy_to_microsoft_marketplace:
runs-on: ubuntu-latest
name: Deploy to Visual Studio marketplace
needs: release
strategy:
# Deployment jobs are executed sequentially to make sure that the universal package is the last one deployed
max-parallel: 1
matrix:
platform: ['win32-x64', 'linux-x64', 'darwin-x64', 'darwin-arm64', 'universal']
steps:
- name: Checkout custom actions
uses: actions/checkout@v3
with:
clean: false
- name: Use Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies for vsce-publish
run: npm install
working-directory: ./.github/actions/vsce-publish
- name: Extract version, file name and download URL
id: extract_version
shell: python
run: |
import os
#
# Extract version, build file name and download URL from GH ref
#
# See https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
tagName = '${{ github.ref_name }}'
# tagName = <version>+<buildId>
version = tagName.split('+')[0]
platform = '${{ matrix.platform }}'
artifactoryPublicRepo = 'https://repox.jfrog.io/artifactory/sonarsource-public-releases'
slvscodeBaseUrl = f'{artifactoryPublicRepo}/org/sonarsource/sonarlint/vscode/sonarlint-vscode'
if platform == 'universal':
artifactName = f'sonarlint-vscode-{version}.vsix'
else:
artifactName = f'sonarlint-vscode-{platform}-{version}.vsix'
artifactUrl = f'{slvscodeBaseUrl}/{version}/{artifactName}'
with open(os.environ['GITHUB_OUTPUT'], 'a') as githubOutput:
print(f'artifactUrl={artifactUrl}', file=githubOutput)
print(f'artifactName={artifactName}', file=githubOutput)
- name: Download promoted file
id: download_artifact
run: |
curl -s -o ${{ steps.extract_version.outputs.artifactName }} ${{ steps.extract_version.outputs.artifactUrl }}
echo 'artifactFile='$(pwd)/${{ steps.extract_version.outputs.artifactName }} >> ${GITHUB_OUTPUT}
- name: Publish to Visual Studio Marketplace
if: success()
id: vsce_publish
env:
ARTIFACT_FILE: ${{ steps.download_artifact.outputs.artifactFile }}
TARGET_PLATFORM: ${{ matrix.platform }}
VSCE_TOKEN: ${{ secrets.VISUALSTUDIO_PAT }}
uses: ./.github/actions/vsce-publish
deploy_to_openvsx:
runs-on: ubuntu-latest
name: Deploy to OpenVSX
needs: release
steps:
- name: Checkout custom actions
uses: actions/checkout@v3
- name: Use Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies for ovsx-publish
run: npm install
working-directory: ./.github/actions/ovsx-publish
- name: Extract version, file name and download URL
id: extract_version
shell: python
run: |
import os
#
# Extract version, build file name and download URL from GH ref
#
# See https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
tagName = '${{ github.ref_name }}'
# tagName = <version>+<buildId>
version = tagName.split('+')[0]
artifactoryPublicRepo = 'https://repox.jfrog.io/artifactory/sonarsource-public-releases'
slvscodeBaseUrl = f'{artifactoryPublicRepo}/org/sonarsource/sonarlint/vscode/sonarlint-vscode'
artifactName = f'sonarlint-vscode-{version}.vsix'
artifactUrl = f'{slvscodeBaseUrl}/{version}/{artifactName}'
with open(os.environ['GITHUB_OUTPUT'], 'a') as githubOutput:
print(f'artifactUrl={artifactUrl}', file=githubOutput)
print(f'artifactName={artifactName}', file=githubOutput)
- name: Download promoted file
id: download_artifact
run: |
curl -s -o ${{ steps.extract_version.outputs.artifactName }} ${{ steps.extract_version.outputs.artifactUrl }}
echo 'artifactFile='$(pwd)/${{ steps.extract_version.outputs.artifactName }} >> ${GITHUB_OUTPUT}
- name: Publish to OpenVSX
if: success()
id: ovsx_publish
env:
ARTIFACT_FILE: ${{ steps.download_artifact.outputs.artifactFile }}
OPENVSX_TOKEN: ${{ secrets.OPENVSX_TOKEN }}
uses: ./.github/actions/ovsx-publish