Skip to content

scout9ll/alioss-deploy-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Ali-OSS Deploy

This is a simple GitHub Action to deploy a static website to ali-oss.

Usage

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 }}

Inputs

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

Example

Deploy to production on release

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 }}

Preview Deploy on pull request

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 }}