Skip to content

Commit 64324e0

Browse files
authored
Update publish.yml
use github pages from CI
1 parent 1f46120 commit 64324e0

File tree

1 file changed

+46
-43
lines changed

1 file changed

+46
-43
lines changed

.github/workflows/publish.yml

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
11
# this workflow builds the cv,
22
# uploads it to the GitHub release that triggered the job
3-
# and uploads built files to the publish branch, where they are served by GitHub pages
3+
# and uploads built files to GitHub pages
44
name: build cv and publish to GitHub release and github pages site
55

66
on:
77
push:
88
tags:
99
- "*"
1010

11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
1123
jobs:
1224
build:
1325
runs-on: ubuntu-latest
1426
steps:
15-
- uses: actions/checkout@v3
16-
- uses: oven-sh/setup-bun@v1
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v4
31+
- name: Setup Bun
32+
uses: oven-sh/setup-bun@v1
1733

1834
- name: Install dependencies
1935
run: bun install
@@ -23,7 +39,19 @@ jobs:
2339
run: bun run build-html
2440
- name: Build pdf
2541
run: bun run build-pdf
42+
- name: Rename files
43+
run: |
44+
mv build/cv.html build/index.html
45+
mv build/cv.pdf build/Alfie-Renn-CV.pdf
2646
47+
- name: Copy build files
48+
run: cp -r build/* _site/
49+
- name: Copy static files
50+
run: cp -r public/* _site/
51+
52+
- name: Upload GitHub Pages artifact
53+
uses: actions/upload-pages-artifact@v2
54+
2755
- name: Save build folder as artifact
2856
uses: actions/upload-artifact@v3
2957
with:
@@ -32,8 +60,19 @@ jobs:
3260
- name: Save pdf as artifact
3361
uses: actions/upload-artifact@v2
3462
with:
35-
name: cv.pdf
36-
path: build/cv.pdf
63+
name: Alfie-Renn-CV.pdf
64+
path: build/Alfie-Renn-CV.pdf
65+
66+
deploy:
67+
environment:
68+
name: github-pages
69+
url: ${{ steps.deployment.outputs.page_url }}
70+
runs-on: ubuntu-latest
71+
needs: build
72+
steps:
73+
- name: Deploy to GitHub Pages
74+
id: deployment
75+
uses: actions/deploy-pages@v3
3776

3877
publish-to-release:
3978
needs: build
@@ -62,43 +101,7 @@ jobs:
62101
uses: svenstaro/upload-release-action@v2
63102
with:
64103
repo_token: ${{ secrets.GITHUB_TOKEN }}
65-
file: build/cv.pdf
66-
asset_name: cv.pdf
104+
file: build/Alfie-Renn-CV.pdf
105+
asset_name: Alfie-Renn-CV.pdf
67106
tag: ${{ github.ref }}
68107
overwrite: true
69-
70-
publish-to-gh-pages-branch:
71-
needs: build
72-
runs-on: ubuntu-latest
73-
permissions:
74-
contents: write
75-
steps:
76-
- name: Checkout main branch
77-
uses: actions/checkout@v3
78-
with:
79-
ref: main
80-
81-
- name: Download artifact
82-
uses: actions/download-artifact@v3
83-
with:
84-
name: build
85-
path: build
86-
87-
- name: Remove old files from /docs
88-
run: rm -rf docs/*
89-
90-
- name: Copy build files to /docs
91-
run: cp -r build/* docs/
92-
93-
- name: Copy static files to /docs
94-
run: cp -r public/* docs/
95-
96-
- name: Rename cv.html to index.html
97-
run: mv docs/cv.html docs/index.html
98-
- name: Rename cv.pdf to Alfie-Renn-CV.pdf
99-
run: mv docs/cv.pdf docs/Alfie-Renn-CV.pdf
100-
101-
- name: Git auto commit
102-
uses: stefanzweifel/git-auto-commit-action@v4
103-
with:
104-
commit_message: "Update cv to ${{ github.ref_name }}"

0 commit comments

Comments
 (0)