[GHA] Fix VSIX builds uploads/deletes #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Snapshot VSCode Extension | ||
|
Check failure on line 1 in .github/workflows/snapshot-vscode-extension.yml
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| extension-name: | ||
| description: name of the extension, e.g. vscode-spring-cli | ||
| required: true | ||
| type: string | ||
| workflow_call: | ||
| inputs: | ||
| extension-name: | ||
| description: name of the extension, e.g. vscode-spring-cli | ||
| required: true | ||
| type: string | ||
| 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: | ||
| build-vscode-extension: | ||
| runs-on: ubuntu-latest | ||
| name: Build VSCode Extension '${{ inputs.extension-name }}' Snapshot | ||
| steps: | ||
| - name: Checkout vscode-extensions code and workflow scripts | ||
| uses: actions/checkout@v4 | ||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| - name: version | ||
| run: | | ||
| cd ${{ github.workspace }}/vscode-extensions/${{ inputs.extension-name } | ||
| version=$(npm pkg get version) | ||
| cd ${{ github.workspace }} | ||
| echo $version | ||
| echo "version=$version" >> $GITHUB_OUTPUT | ||
| - name: Build .VSIX file | ||
| id: build-vsix | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| ${{ github.workspace }}/.github/scripts/build-vscode-extension.sh ${{ inputs.extension-name }} snapshot | ||
| 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=snapshot/vscode-extensions/${{ inputs.extension-name }} | ||
| echo "S3 path: ${s3_path}" | ||
| aws s3 rm s3://$AWS_S3_BUCKET/$s3_path/ --recursive --exclude "*" --include "${{ inputs.extension-name }}-${{ steps.version.outputs.version }}*.vsix" | ||
| aws s3 cp ./vsix/$vsix_file s3://$AWS_S3_BUCKET/$s3_path/$vsix_file --no-progress --checksum-algorithm CRC32 | ||
| - name: Update Nightly Builds download page | ||
| run: | | ||
| downloads_html="vscode-extensions-snippet.html" | ||
| echo '<ul>' >> $downloads_html | ||
| echo `${{ github.workspace }}/.github/scripts/gen-vscode-link-bullet.sh vscode-spring-boot "Spring Boot Tools" $DOWNLOAD_URL_ROOT ${{ steps.version.outputs.version }}` >> $downloads_html | ||
| echo `${{ github.workspace }}/.github/scripts/gen-vscode-link-bullet.sh vscode-concourse "Concourse Editor" $DOWNLOAD_URL_ROOT ${{ steps.version.outputs.version }}` >> $downloads_html | ||
| echo `${{ github.workspace }}/.github/scripts/gen-vscode-link-bullet.sh vscode-bosh "Bosh Editor" $DOWNLOAD_URL_ROOT ${{ steps.version.outputs.version }}` >> $downloads_html | ||
| echo `${{ github.workspace }}/.github/scripts/gen-vscode-link-bullet.sh vscode-manifest-yaml "CF Manifest Editor" $DOWNLOAD_URL_ROOT ${{ steps.version.outputs.version }}` >> $downloads_html | ||
| echo `${{ github.workspace }}/.github/scripts/gen-vscode-link-bullet.sh vscode-spring-cli "Spring CLI" $DOWNLOAD_URL_ROOT ${{ steps.version.outputs.version }}` >> $downloads_html | ||
| echo '</ul>' >> $downloads_html | ||
| cat ./$downloads_html | ||
| aws s3 mv ./$downloads_html s3://$AWS_S3_BUCKET/snapshot/vscode-extensions/ --no-progress --checksum-algorithm CRC32 | ||