|
1 | 1 | # this workflow builds the cv, |
2 | 2 | # 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 |
4 | 4 | name: build cv and publish to GitHub release and github pages site |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
8 | 8 | tags: |
9 | 9 | - "*" |
10 | 10 |
|
| 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 | + |
11 | 23 | jobs: |
12 | 24 | build: |
13 | 25 | runs-on: ubuntu-latest |
14 | 26 | 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 |
17 | 33 |
|
18 | 34 | - name: Install dependencies |
19 | 35 | run: bun install |
|
23 | 39 | run: bun run build-html |
24 | 40 | - name: Build pdf |
25 | 41 | 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 |
26 | 46 |
|
| 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 | + |
27 | 55 | - name: Save build folder as artifact |
28 | 56 | uses: actions/upload-artifact@v3 |
29 | 57 | with: |
|
32 | 60 | - name: Save pdf as artifact |
33 | 61 | uses: actions/upload-artifact@v2 |
34 | 62 | 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 |
37 | 76 |
|
38 | 77 | publish-to-release: |
39 | 78 | needs: build |
@@ -62,43 +101,7 @@ jobs: |
62 | 101 | uses: svenstaro/upload-release-action@v2 |
63 | 102 | with: |
64 | 103 | 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 |
67 | 106 | tag: ${{ github.ref }} |
68 | 107 | 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