-
Notifications
You must be signed in to change notification settings - Fork 208
136 lines (131 loc) · 5.16 KB
/
release-vscode-extension.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
name: Release VSCode Extension
on:
workflow_dispatch:
inputs:
extension-name:
description: name of the extension, e.g. vscode-spring-cli
required: true
type: string
postfix:
description: For example "RC1"
required: true
type: string
tag:
description: tag the git repo if value is 'true'
required: true
type: boolean
permissions:
contents: write
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CDN_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_S3_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL_S3: ${{ secrets.CDN_S3_ENDPOINT }}
AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}/spring-tools
DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools
jobs:
release-vscode-extension:
runs-on: ubuntu-latest
name: Release Build and Upload VSCode Extension '${{ inputs.extension-name }}'
steps:
- name: Checkout vscode-extension '${{ inputs.extension-name }}'
uses: actions/checkout@v4
- name: Record Extension Version
id: version
run: |
base_version=`jq -r .version vscode-extensions/${{ inputs.extension-name }}/package.json`
release_name=${{ inputs.extension-name }}-$base_version-${{ inputs.postfix }}
echo "Version: ${base_version}"
echo "Release Name: ${release_name}"
echo "version=$base_version" >> $GITHUB_OUTPUT
echo "release_name=$release_name" >> $GITHUB_OUTPUT
- name: Create tag
if: ${{ inputs.tag }}
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.version.outputs.release_name }}',
sha: context.sha
})
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Build .VSIX file
id: build-vsix
run: |
${{ github.workspace }}/.github/scripts/build-vscode-extension.sh ${{ inputs.extension-name }} release
ls ./vsix
- name: Upload VSIX
id: upload-release
run: |
vsix_file=`ls ./vsix | head -n 1`
echo "VSIX file to upload ${vsix_file}"
s3_path=release/vscode-extensions/${{ inputs.extension-name }}/${{ steps.version.outputs.version }}
echo "S3 path: ${s3_path}"
aws s3 rm s3://$AWS_S3_BUCKET/$s3_path/ --recursive
aws s3 cp ./vsix/$vsix_file s3://$AWS_S3_BUCKET/$s3_path/${{ steps.version.outputs.release_name }}.vsix --no-progress
echo "s3_url=${DOWNLOAD_URL_ROOT}/$s3_path/${{ steps.version.outputs.release_name }}.vsix" >> $GITHUB_OUTPUT
# - id: tools-team-slack
# uses: slackapi/slack-github-action@v1.26
# env:
# SLACK_BOT_TOKEN: ${{ secrets.VMWARE_SLACK_BOT_TOKEN }}
# with:
# channel-id: "C0188MENU2J"
# payload: |
# {
# "text": "Release build `${{ steps.version.outputs.release_name }}`",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "Release build for `${{ steps.version.outputs.release_name }}` is available: ${{ steps.upload-release.outputs.s3_url }}"
# }
# }
# ]
# }
- name: GChat spring-tools-team notification
run: |
curl --location --request POST '${{ secrets.TOOLS_TEAM_GCHAT_WEBHOOK_URL }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"cards": [
{
"header": {
"title": "${{ inputs.extension-name }} ${{ steps.version.outputs.version }}",
"subtitle": "Release Candidate ${{ inputs.postfix }}",
"imageUrl": "https://code.visualstudio.com/assets/images/code-stable.png",
},
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "VSCode extension <b>${{ inputs.extension-name }}</b> release candidate build <b>${{ inputs.postfix }}</b> is available: <a href=${{ steps.upload-release.outputs.s3_url }}>${{ steps.version.outputs.release_name }}.vsix</a>"
}
},
{
"buttons": [
{
"textButton": {
"text": "Download VSIX",
"onClick": {
"openLink": {
"url": "${{ steps.upload-release.outputs.s3_url }}"
}
}
}
}
]
}
]
}
]
}
]
}'