initial commit #8
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
name: Deploy | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
PROJECT: vcportal | |
S3_DOMAIN: cos.accelerate.myqcloud.com | |
S3_BUCKET: luotianyi-dev-1251131545 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Dependencies | |
run: pdm install && pdm add git+https://github.com/luotianyi-dev/deploykit.git | |
- name: Set S3 Prefix | |
run: echo "S3_PREFIX=web/host/$PROJECT/$(date +%Y%m%d-%H%M%S)-${{ github.sha }}" >> $GITHUB_ENV | |
- name: Build | |
run: pdm run portal-build --assets-cdn-url $CDN_URL/assets --css-cdn-url $CDN_URL/css build --clean --with-assets --with-css --with-manifest | |
env: | |
CDN_URL: https://${{ env.S3_BUCKET }}.${{ env.S3_DOMAIN }}/${{ env.S3_PREFIX }} | |
- name: Upload to DeployKit | |
run: pdm run deployctl deploy upload --commit ${{ github.sha }} -f dist public -f server.conf server.conf --switch | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
- name: Upload to S3 | |
run: pdm run deployctl s3 --bucket ${{ env.S3_BUCKET }} --prefix ${{ env.S3_PREFIX }} -f assets -f css | |
env: | |
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
S3_ENDPOINT: https://${{ env.S3_DOMAIN }} | |
working-directory: ./dist |