/upyun-deployer

Github action to deploy your site to upyun

Primary LanguageGoMIT LicenseMIT

GitHub Action to deploy your site to upyun

This GitHub Action will deploy your site to upyun. For more information, please refer to https://her-cat.com/posts/2023/01/31/blog-migration-to-upyun/.

Inputs

  • bucket: Required The service name you are using on upyun.
  • operator: Required Your operator's account on upyun.
  • password: Required Your operator's password on upyun.
  • dir: Optional The directory where the file you want to upload is located. The default value is an empty string.
  • publish_dir: Optional Upload to the specified directory. The default value is an empty string.

Example usage

For example, if you want to upload all the files in the public directory under the repository to upyun's myblog directory, you need to set dir to public and publish_dir to myblog.

Note that if you want to upload all the files in the root directory of the repository, or upload to the root directory of upyun, you just need to set the directory to empty or not set this parameter.

name: Deploy to UpYun

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository master branch
        uses: actions/checkout@master

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v1
        with:
          hugo-version: '0.101.0'

      - name: Build static files
        run: hugo --minify --environment production

      - name: Deploy
        uses: her-cat/upyun-deployer@v1.0.3
        with:
          bucket: ${{ secrets.UPYUN_BUCKET }}
          operator: ${{ secrets.UPYUN_OPERATOR_NAME }}
          password: ${{ secrets.UPYUN_OPERATOR_PWD }}
          dir: 'public'
          publish_dir: 'myblog'

Before use, you need to configure Actions secrets in the repository settings. The static files generated by hugo are saved in the public directory by default, so here dir is set to public.

License

The scripts and documentation in this project are released under the MIT License