Deploying AIO preview to Aliyun OSS #5
This file contains 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
# This workflow runs whenever the AIO build workflow has completed. Deployment happens | |
# as part of a dedicated second workflow to avoid security issues where the building would | |
# otherwise occur in an authorized context where secrets could be leaked. | |
# | |
# More details can be found here: | |
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. | |
name: Deploying AIO preview to Aliyun OSS | |
on: | |
workflow_run: | |
workflows: [ 'Build AIO app for preview deployment' ] | |
types: [ completed ] | |
permissions: | |
# Needed in order to be able to comment on the pull request. | |
pull-requests: write | |
jobs: | |
upload_to_oss: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install Aliyun CLI | |
run: | | |
curl https://gosspublic.alicdn.com/ossutil/1.7.19/ossutil-v1.7.19-linux-amd64.zip | |
unzip ossutil-v1.7.19-linux-amd64.zip | |
echo "$ACCESS_KEY_ID" >> $GITHUB_ENV | |
echo "$ACCESS_KEY_SECRET" >> $GITHUB_ENV | |
echo "$OSS_BUCKET" >> $GITHUB_ENV | |
echo "$OSS_REGION" >> $GITHUB_ENV | |
- name: Configure Aliyun CLI | |
run: | | |
aliyun configure set --profile default --access-key-id ${{ env.ACCESS_KEY_ID }} --access-key-secret ${{ env.ACCESS_KEY_SECRET }} | |
- name: Compress and Upload to OSS | |
run: | | |
cd dist | |
aliyun oss cp -r ./dist/bin/aio/build oss://${{ env.OSS_BUCKET }}/ | |
env: | |
ACCESS_KEY_ID: ${{ secrets.ALIYUN_OSS_ACCESS_KEY_ID }} | |
ACCESS_KEY_SECRET: ${{ secrets.ALIYUN_OSS_ACCESS_KEY_SECRET }} | |
OSS_BUCKET: angular-en | |
OSS_REGION: oss-cn-zhangjiakou # 替换为你实际的OSS区域 |