-
Notifications
You must be signed in to change notification settings - Fork 5
59 lines (55 loc) · 1.9 KB
/
Copy pathdeploy-gh-pages.yml
File metadata and controls
59 lines (55 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
name: "🚀 GitHub Pages"
on:
workflow_dispatch:
push:
branches: [main]
tags: ["v*.*.*"]
paths:
- "public/**"
- ".github/workflows/deploy-gh-pages.yml"
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy:
if: github.repository == 'z-shell/src'
environment:
name: github-pages
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- 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@84c30a85c19949d7eee79c4ff27748b70285e453 # v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./public
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 }}"