-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (92 loc) · 2.89 KB
/
ci.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
name: Pre-commit checks, build and test Docker image, upload PDFs to GitHub Pages
on:
pull_request:
push:
branches: [main]
tags: ['v*.*.*']
workflow_dispatch:
env:
IMAGE_TAG: ${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:${{ github.ref_name }}
IMAGE_TAG_TESTING: ${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:testing
OUTPUT_DIR: public
ARTIFACTS_NAME: pdf
jobs:
pre_commit:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
docker:
name: Build and push testing Docker image
needs: pre_commit
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.IMAGE_TAG_TESTING }}
cache-from: type=registry,ref=${{ env.IMAGE_TAG_TESTING }}
cache-to: type=inline
render:
name: Render default files and update Docker tags
needs: docker
runs-on: ubuntu-latest
steps:
- name: Render with testing Docker image
run: >
docker container run
-v "${PWD}:/data/public"
--user "$(id -u):$(id -g)"
${{ env.IMAGE_TAG_TESTING }}
- name: Upload rendered PDFs
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACTS_NAME }}
path: ./*.pdf
if-no-files-found: error
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update Docker tag
run: |
docker image tag ${{ env.IMAGE_TAG_TESTING }} ${{ env.IMAGE_TAG }}
docker image push ${{ env.IMAGE_TAG }}
publish:
name: Publish to GitHub pages
needs: render
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
- name: Download rendered PDFs
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACTS_NAME }}
path: ${{ env.OUTPUT_DIR }}/
- name: Add HTML for GitHub Pages
run: cp ./*.html ${{ env.OUTPUT_DIR }}/
- name: Deploy CV to GitHub pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./${{ env.OUTPUT_DIR }}