This is a simple GitHub Action to deploy a static website to ali-oss.
To use a GitHub action you can just reference it on your Workflow file (for more info check this article by Github)
name: 'My Workflow'
on:
release:
types: [published]
jobs:
deploy:
name: 'Deploy to ali-oss'
steps:
- uses: steve9II/alioss-deploy-action
with:
staticPath: your local static path
deployPath: your expected ali-oss path
region: ${{ secrets.region }}
bucket: ${{ secrets.bucket }}
accessKeyId: ${{ secrets.accessKeyId }}
accessKeySecret: ${{ secrets.accessKeySecret }}
As most GitHub actions, this action requires and uses some inputs, that you define in your workflow file.
The inputs this action uses are:
we should not write sensitive information into action file ,please store these in github (how to create secret in github)
Name | Required | Default | Description |
---|---|---|---|
accessKeyId |
true |
N/A | your ali-oss accessKeyId(create here) |
accessKeySecret |
true |
N/A | your ali-oss accessKeySecret |
region |
true |
N/A | your oss region |
bucket |
true |
N/A | your bucket |
staticPath |
true |
N/A | your local static files path |
deployPath |
true |
N/A | your expected ali-oss deploy directory |
You can setup repo secrets to use in your workflows
name: 'ali-oss Deploy'
on:
push:
branches:
- master
tags:
- v1
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'public/*'
jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: steve9II/alioss-deploy-action
with:
staticPath: your local static path
deployPath: your expected ali-oss path
region: ${{ secrets.region }}
bucket: ${{ secrets.bucket }}
accessKeyId: ${{ secrets.accessKeyId }}
accessKeySecret: ${{ secrets.accessKeySecret }}
name: 'ali-oss Preview Deploy'
on:
pull_request:
types: ['opened', 'edited', 'synchronize']
jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: steve9II/alioss-deploy-action
with:
staticPath: your local static path
deployPath: your expected ali-oss path
region: ${{ secrets.region }}
bucket: ${{ secrets.bucket }}
accessKeyId: ${{ secrets.accessKeyId }}
accessKeySecret: ${{ secrets.accessKeySecret }}