[GHA] GCP Backup upload working

This commit is contained in:
aboyko
2024-07-16 13:28:54 -04:00
parent 21fa3ef658
commit e23b2be87b
4 changed files with 35 additions and 41 deletions

View File

@@ -8,7 +8,7 @@ on:
required: true
type: string
release_version:
description: Release version (i.e. 4.20.1)
description: Release version (i.e. 4.20.1.RELEASE)
required: true
type: string
@@ -19,6 +19,7 @@ env:
AWS_ENDPOINT_URL_S3: ${{ secrets.CDN_S3_ENDPOINT }}
AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}
DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools
GCP_BUCKET: gs://cdn-spring-io
jobs:
backup-eclipse-releases-to-gcp:
@@ -27,23 +28,19 @@ jobs:
steps:
- name: Authenticate to GCP
run: |
echo -e "${{ secrets.CDN_SPRING_IO_BACKUP_GCP_BUCKET_JSON }} " > ~/gcp.json
gcloud auth activate-service-account --key-file=~/gcp.json
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github/scripts
- name: Download from S3, Upload to GCP
echo '${{ secrets.CDN_SPRING_IO_BACKUP_GCP_BUCKET_JSON }}' > ./gcp.json
gcloud auth activate-service-account --key-file=./gcp.json
rm -f gcp.json
- name: Copy from S3 to GCP
run: |
echo "Copying Eclipse LS extensions ${{ inputs.ls_version }} to GCP..."
url_path=spring-tools/release/TOOLS/sts4-language-server-integrations/${{ inputs.ls_version }}
echo "Copying Eclipse LS extensions ${{ inputs.ls_version }} to GCP..."
${{ github.workspace }}/.github/scripts/copy-from-s3-to-gcp.sh s3://$AWS_S3_BUCKET/$url_path gs://gcp-test-spring-io/$url_path
gcloud storage cp s3://$AWS_S3_BUCKET/$url_path $GCP_BUCKET/$url_path --recursive
echo "Copying Eclipse Distro P2 repos ${{ inputs.ls_version }} to GCP..."
url_path=spring-tools/release/TOOLS/sts4/update/${{ inputs.release_version }}.RELEASE
${{ github.workspace }}/.github/scripts/copy-from-s3-to-gcp.sh s3://$AWS_S3_BUCKET/$url_path gs://gcp-test-spring-io/$url_path
echo "Copying Eclipse Distros ${{ inputs.release_version }} to GCP..."
url_path=spring-tools/release/STS4/${{ inputs.release_version }}.RELEASE/dist
${{ github.workspace }}/.github/scripts/copy-from-s3-to-gcp.sh s3://$AWS_S3_BUCKET/$url_path gs://gcp-test-spring-io/$url_path
echo "Copying Eclipse Distro P2 repos ${{ inputs.release_version }} to GCP..."
url_path=spring-tools/release/TOOLS/sts4/update/${{ inputs.release_version }}
gcloud storage cp s3://$AWS_S3_BUCKET/$url_path $GCP_BUCKET/$url_path --recursive
echo "Copying Eclipse Distros ${{ inputs.release_version }} to GCP..."
url_path=spring-tools/release/STS4/${{ inputs.release_version }}/dist
gcloud storage cp s3://$AWS_S3_BUCKET/$url_path $GCP_BUCKET/$url_path --recursive

View File

@@ -38,6 +38,12 @@ jobs:
latest: ${{ inputs.eclipse_latest }}
secrets: inherit
backup-release-on-gcp:
uses: ./.github/workflows/backup-eclipse-releases-to-gcp.yml
with:
ls_version: ${{ inputs.ls_version }}
release_version: ${{ inputs.release_version }}.RELEASE
# create-github-release:
# uses: ./.github/workflows/create-gh-release.yml
# with:

View File

@@ -17,10 +17,12 @@ on:
type: string
env:
DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools
DOWNLOAD_URL_ROOT: https://cdn.spring.io
VSIX_FILE: ${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix
URL_PATH: spring-tools/release/vscode-extensions/${{ inputs.extension-name }}/${{ inputs.version }}
GCP_BUCKET: gs://cdn-spring-io
jobs:
publish-release:
runs-on: ubuntu-latest
name: Publish '${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix'
@@ -28,20 +30,23 @@ jobs:
- name: Download Release VSIX
id: download-release
run: |
vsix_file=${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix
wget $DOWNLOAD_URL_ROOT/release/vscode-extensions/${{ inputs.extension-name }}/${{ inputs.version }}/$vsix_file
wget $DOWNLOAD_URL_ROOT/$URL_PATH/$VSIX_FILE
- name: Publish to VSCode Marketplace
id: publish-vsce
run: |
npm install --global @vscode/vsce
vsix_file=${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix
vsce publish -p ${{ secrets.VSCE_PUBLISH_TOKEN }} --packagePath $vsix_file
vsce publish -p ${{ secrets.VSCE_PUBLISH_TOKEN }} --packagePath $VSIX_FILE
- name: Publish to Eclipse Open VSX
id: publish-ovsx
run: |
npm install --global ovsx
vsix_file=${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix
ovsx publish -p ${{ secrets.OVSX_PUBLISH_TOKEN }} $vsix_file
ovsx publish -p ${{ secrets.OVSX_PUBLISH_TOKEN }} $VSIX_FILE
- name: Upload to GCP
run: |
echo '${{ secrets.CDN_SPRING_IO_BACKUP_GCP_BUCKET_JSON }}' > ./gcp.json
gcloud auth activate-service-account --key-file=./gcp.json
rm -f gcp.json
gcloud storage cp $VSIX_FILE $GCP_BUCKET/$URL_PATH/$VSIX_FILE
- id: tools-team-slack
uses: slackapi/slack-github-action@v1.26
env:
@@ -50,7 +55,7 @@ jobs:
channel-id: "C0188MENU2J"
payload: |
{
"text": "Published release `${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix`",
"text": "Published release `$VSIX_FILE`",
"blocks": [
{
"type": "section",