Skip to content

Commit

Permalink
[GHA] Refine release vscode extension workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Jul 14, 2024
1 parent 515af18 commit 11009f0
Showing 1 changed file with 53 additions and 11 deletions.
64 changes: 53 additions & 11 deletions .github/workflows/release-vscode-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ on:
description: For example "RC1"
required: true
type: string
tag:
description: tags the repository 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:

tag-vscode-extension:
Expand All @@ -23,16 +36,14 @@ jobs:
steps:
- name: Checkout vscode-extension '${{ inputs.extension-name }}'
uses: actions/checkout@v4
with:
sparse-checkout: |
vscode-extensions/${{ inputs.extension-name }}
- name: Record Extension Version
id: version
run: |
base_version=`jq -r .version vscode-extensions/${{ inputs.extension-name }}/package.json`
echo "Version: ${base_version}"
echo "version=$base_version" >> $GITHUB_OUTPUT
- name: Create tag
if: ${{ inputs.tag }}
uses: actions/github-script@v7
with:
script: |
Expand All @@ -42,12 +53,43 @@ jobs:
ref: 'refs/tags/${{ inputs.extension-name }}-${{ steps.version.outputs.version }}-${{ inputs.postfix }}',
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/$vsix_file --no-progress
echo "s3_url=${DOWNLOAD_URL_ROOT}/$s3_path/$vsix_file" >> $GITHUB_OUTPUT
- id: tools-team-slack
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.VMWARE_SLACK_BOT_TOKEN }}
with:
channel-id: "C0188MENU2J"
payload: |
{
"text": "Release build `${{ inputs.extension-name }}-${{ steps.version.outputs.version }}`",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Release build for `${{ inputs.extension-name }}-${{ steps.version.outputs.version }}` is available: ${{ steps.upload-release.outputs.s3_url }}"
}
}
]
}
release-build-upload:
needs: [ tag-vscode-extension ]
uses: ./.github/workflows/build-vscode-extension.yml
name: Build and Upload VSCode Extension '${{ inputs.extension-name }}' Release
with:
extension-name: ${{ inputs.extension-name }}
dist: 'release'
secrets: inherit

0 comments on commit 11009f0

Please sign in to comment.