Update gitsite.yml #48
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
# Sample workflow for building and deploying a GitSite repo to GitHub Pages | |
# | |
# To get started with GitSite see: https://gitsite.org | |
name: Build by GitSite | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Setup Env | |
run: | |
echo "RELEASE_AT=`echo ${{ github.event.head_commit.timestamp }} | sed 's/[:+]/-/g'`" >> "$GITHUB_ENV" | |
- name: Print Env | |
run: | |
echo ${{ env.RELEASE_AT }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install GitSite | |
run: | |
npm install gitsite-cli -g | |
- name: Build with GitSite | |
run: | |
# set output dir to '_site' for pages jobs: | |
gitsite-cli build -o _site | |
- name: Zip Generated Site | |
run: | |
cd _site && zip -r ../site.zip * && cd .. | |
- name: Upload to AliOSS | |
uses: JohnGuan/oss-upload-action@main | |
with: | |
key-id: ${{ secrets.OSS_KEY_ID }} | |
key-secret: ${{ secrets.OSS_KEY_SECRET }} | |
region: ${{ secrets.OSS_REGION }} | |
bucket: ${{ secrets.OSS_BUCKET }} | |
assets: site.zip:upload/site-${{ env.RELEASE_AT }}.zip | |
- name: Release Zip | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: site.zip | |
tag: ${{ github.ref }}.${{ github.sha }} | |
overwrite: true |