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: Build and deploy to production. | |
env: | |
OSS_ENDPOINT: oss-cn-beijing.aliyuncs.com | |
APP_ENV: prod | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'xiaolai' | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
node_modules | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('./yarn.lock') }} | |
- name: Setup node env | |
uses: actions/setup-node@master | |
with: | |
node-version: "12" | |
# upload to aliyun | |
- uses: yizhoumo/setup-ossutil@v1 | |
with: | |
endpoint: ${{ env.OSS_ENDPOINT }} | |
access-key-id: ${{ secrets.GLOBAL_OSS_ACCESS_KEY_ID }} | |
access-key-secret: ${{ secrets.GLOBAL_OSS_ACCESS_KEY_SECRET }} | |
- run: ossutil cp -r -u -f ./ ${{ secrets.OSS_URL_PROD }} -e ${{ env.OSS_ENDPOINT }} | |
- run: ossutil set-meta ${{ secrets.OSS_URL_PROD }}/index.html Cache-Control:no-cache --update -e ${{ env.OSS_ENDPOINT }} |