This article mainly describes how individuals use GitHub Actions to generate static website automatically published to Ali OSS and bound to personal domain name access, share the pit experience, hope to help you.

Create buckets in OSS

Note here that if the domain name is not registered, you can choose the node of the overseas region. The following figure takes Singapore as an example:

Create a Bucket

Change the OSS write and read permission

img

To obtainAccessKey

img

Using ali recommended subuser **AccessKey, ** can configure permissions

img

img

GitHub fill in Accesskey ID and Secret

img

Making Actions to write

`name: deploy blog` `on:` `push:` `schedule:` `- cron: '30 20 * * *'` `jobs:` `build:` `runs-on: ubuntu-latest` `steps:` `- uses: actions/checkout@v2` `with:` `submodules: 'recursive'` `- uses: Srt32 /[email protected] ' 'with:' 'args: git submodule update --init --recursive' - name: use node.js 10.x ' 'uses: actions/setup-node@v1` `with:` `node-version: 10.x` `- name: npm i Hugo` `uses: peaceiris/actions-hugo@v2` `- name: Build ` ` run: | ` ` Hugo - minify ` ` # Hugo - minify to ubuntu - latest is deployed, Hugo, need not can remove ` ` - name: the setup aliyun oss ` ` USES: Manyuanrong /setup-ossutil@master 'with:' endpoint: OSs-ap-southecommencement 1.aliyuncs.com ${{ secrets.OSS_KEY_ID }}` `access-key-secret: ${{ secrets.OSS_KEY_SECRET }}` `- name: cp aliyun oss` `run: Ossutil cp -rf public oss://zongtang/ # modify to own 'Copy the code

Notice the comments in the code

Running effect

img

img

Parsing the domain name

I am using the domain name service provided by Tencent, because the record value is not an IP address, so the record type is CNAME, and the record value is the domain name in the OSS overview, as marked in the first picture

img

Test access

img

Welcome to my blog or wechat public number LiuJohntun to see the whole site construction process, Currently it has been simplified to write markdown articles directly on Forestry. IO after previewing them correctly and then submitting them through GitHub Actions automatically deployed to GitHubPages, GiteePages, OSS object storage

If the content has the inadequacy place, still hope everybody makes the suggestion many exchanges with me more. More wonderful can follow my blog or wechat public account LiuJohntun, record and share what I see, learn, think…