Skip to content

Commit b58f06a

Browse files
authored
Update blank.yml
1 parent ffea4da commit b58f06a

File tree

1 file changed

+56
-49
lines changed

1 file changed

+56
-49
lines changed

.github/workflows/blank.yml

Lines changed: 56 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,63 @@
1-
# Workflow for building and deploying a Hugo site to GitHub Pages
2-
name: Deploy Hugo site to Pages
1+
# action 이름. 원하는대로 정하면 된다.
2+
name: deploy ghpage
33

4+
# on: 뒤에오는 event가 발생하면 action이 실행된다. 아래는 master branch에 push 나 pull request가 발생하면 action이 실행되는 코드이다. 보통 그냥 두면 된다.
45
on:
56
push:
6-
branches:
7-
- toha
8-
workflow_dispatch:
9-
10-
permissions:
11-
contents: read
12-
pages: write
13-
id-token: write
14-
15-
concurrency:
16-
group: "pages"
17-
cancel-in-progress: false
18-
19-
defaults:
20-
run:
21-
shell: bash
7+
branches: [ toha ]
8+
pull_request:
9+
branches: [ toha ]
2210

11+
# jobs은 실행될 action을 포함하고 있다.
2312
jobs:
13+
2414
build:
25-
runs-on: ubuntu-latest
26-
steps:
27-
- name: Setup Hugo
28-
uses: peaceiris/actions-hugo@v3
29-
with:
30-
hugo-version: latest
31-
extended: true
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
with:
35-
submodules: recursive
36-
fetch-depth: 0
37-
- name: Build with Hugo
38-
env:
39-
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
40-
HUGO_ENVIRONMENT: production
41-
run: |
42-
hugo --gc --minify --baseURL "https://join.mju-rats.com/"
43-
- name: Debug Build Output
44-
run: ls -R ./public || echo "Public directory is empty"
15+
runs-on: ubuntu-22.04
16+
#steps는 명령어 들이다.
17+
# uses는 이미 만들어진 action을 사용하는 것, run은 명령어를 실행하는 것이다.
18+
steps:
19+
20+
#1. 가상머신으로 checkout
21+
- uses: actions/checkout@v4
22+
with:
23+
submodules: true # Fetch Hugo themes (true OR recursive)
24+
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
25+
26+
- name: Checkout submodules
27+
shell: bash
28+
run: |
29+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
30+
git submodule sync --recursive
31+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
32+
# run 다음 내용들은 submodule을 최신으로 udapte한것을 가져오는 내용 + a이다.
33+
34+
#4. Hugo 설치
35+
- name: Setup Hugo
36+
uses: peaceiris/actions-hugo@v3
37+
with:
38+
hugo-version: 'latest'
39+
extended: true
40+
41+
#5. build (public 폴더에 저장 된다.)
42+
- name: Build Hugo Site
43+
run: |
44+
hugo --minify
45+
# - name: Check Public Folder
46+
# run: |
47+
# ls -R ./public || echo "Public folder is empty or not created"
48+
# minify는 압축시키는 것을 의미한다.
49+
# - name: Upload Artifact
50+
# uses: actions/upload-artifact@v4
51+
# with:
52+
# name: hugo-site
53+
# path: ./public
4554

46-
deploy:
47-
needs: build
48-
runs-on: ubuntu-latest
49-
steps:
50-
- name: Deploy to gh-pages
51-
uses: peaceiris/actions-gh-pages@v4
52-
with:
53-
github_token: ${{ secrets.MABANGKEY }}
54-
publish_branch: gh-pages
55-
publish_dir: ./public
56-
cname: join.mju-rats.com
55+
#6.Deploy 배포: git token이 필요하다. gh-pages로 publish하는 것 잊지 말자
56+
#public 폴더를 github page의 gh-pages 브챈치에 배포한다는 의미이다.
57+
- name: Deploy
58+
uses: peaceiris/actions-gh-pages@v4
59+
with:
60+
github_token: ${{ secrets.MABANGKEY }}
61+
publish_branch: gh-pages
62+
publish_dir: ./public
63+
cname: join.mju-rats.com

0 commit comments

Comments
 (0)