Skip to content

Refactor installer scripts and update CI workflows (#160) #108

Refactor installer scripts and update CI workflows (#160)

Refactor installer scripts and update CI workflows (#160) #108

---
name: "🚀 GitHub Pages"
on:
workflow_dispatch:
push:
branches: [main]
tags: ["v*.*.*"]
paths:
- "lib/**"
- ".github/workflows/deploy-gh-pages.yml"
permissions:
contents: write
jobs:
deploy:
if: github.repository == 'z-shell/src'
environment:
name: github-pages
runs-on: ubuntu-latest
timeout-minutes: 15
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "🏷 Prepare deployment metadata"
id: prepare_deploy
run: |
commit_message="$(jq -r '.head_commit.message // empty' "$GITHUB_EVENT_PATH")"
if [ -z "$commit_message" ]; then
commit_message="Deploy ${GITHUB_REF_NAME}"
fi
{
echo "commit_message<<DEPLOY_MESSAGE"
printf '%s\n' "$commit_message"
echo "DEPLOY_MESSAGE"
} >> "$GITHUB_OUTPUT"
- name: "🏷 Prepare tag"
id: prepare_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "deploy_tag_name=deploy-${TAG_NAME}" >> $GITHUB_OUTPUT
- name: 🚀 Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./lib
user_name: ${{ secrets.ACTIONS_USER }}
user_email: ${{ secrets.ACTIONS_MAIL }}
commit_message: ${{ steps.prepare_deploy.outputs.commit_message }}
tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
tag_message: "Deployment ${{ steps.prepare_tag.outputs.tag_name }}"