-
Notifications
You must be signed in to change notification settings - Fork 29
151 lines (137 loc) · 4.57 KB
/
publish.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Publish
on:
workflow_dispatch:
inputs:
lsp_branch:
description: "Branch name to publish"
default: "main"
stable_release:
description: "Publish stable release version"
default: false
type: boolean
jobs:
publish:
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
# - os: ubuntu-20.04
# target: armv7-unknown-linux-gnueabihf
# code-target: linux-armhf
- os: macos-13
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-14
target: aarch64-apple-darwin
code-target: darwin-arm64
env:
LLM_LS_TARGET: ${{ matrix.target }}
name: Publish in marketplace (VSCE) (${{ matrix.target }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Install VSCE
run: |
npm install
npm install -g @vscode/vsce
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build.yml
repo: smallcloudai/refact-lsp
branch: ${{ inputs.lsp_branch }}
path: ./assets
name: dist-${{ matrix.target }}
- name: Package VSCE extension
shell: bash
run: |
chmod +x ./assets/refact-lsp*
if [[ ${{ inputs.stable_release }} != "true" ]]; then
export PRERELEASE=--pre-release
fi
echo "PRERELEASE=${PRERELEASE}"
vsce package --target ${{ matrix.code-target }} ${PRERELEASE}
- name: Publish VSCE extension
shell: bash
run: |
if [[ ${{ inputs.stable_release }} != "true" ]]; then
export PRERELEASE=--pre-release
fi
echo "PRERELEASE=${PRERELEASE}"
vsce publish --pat ${{secrets.VSCE_PAT}} ${PRERELEASE} --packagePath *.vsix
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: vscode-plugin-${{ matrix.target }}
path: ./*.vsix
notify:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Setup vars
shell: bash
id: setupvars
run: |
if [[ ${{ inputs.stable_release }} != "true" ]]; then
echo "slack_notification_channel=prerelease" >> "$GITHUB_OUTPUT"
else
echo "slack_notification_channel=stable" >> "$GITHUB_OUTPUT"
fi
echo "plugin_version=$(cat package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "VSCode plugin ${{ steps.setupvars.outputs.plugin_version }} is released in ${{ steps.setupvars.outputs.slack_notification_channel }} channel",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "by ${{ github.actor }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Notify to Discord
run: |
curl -X POST ${{ secrets.DISCORD_WEBHOOK_URL }} \
-H "Content-Type: application/json" \
-d '{"msg":"VSCode plugin ${{ steps.setupvars.outputs.plugin_version }} is released in ${{ steps.setupvars.outputs.slack_notification_channel }} channel"}'