-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (127 loc) Β· 4.14 KB
/
compile.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Generate PDF
on:
workflow_dispatch:
push:
paths:
- 'release/**'
tags:
- '**'
pull_request:
paths:
- 'release/**'
workflow_run:
workflows: ["Tag"]
types:
- completed
env:
PDF_NAME: Jyotirmoy_Bandyopadhayaya_CV.pdf
MISC_NAME: resume.zip
HTML_NAME: Jyotirmoy_Bandyopadhayaya_CV.html
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: ποΈ Checkout repository
uses: actions/checkout@v4
- name: π Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: π¦ Install dependencies
run: |
python -m pip install --upgrade pip
pip install rendercv
- name: π Install LaTeX
run: |
sudo apt-get update
sudo apt-get install -y texlive-full latexmk
- name: π Generate PDF
run: make all
- name: π€ Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: resume-pdf
path: out/${{ env.PDF_NAME }}
- name: π€ Upload Misc artifact
uses: actions/upload-artifact@v4
with:
name: resume-misc-zip
path: ${{ env.MISC_NAME }}
release:
needs: build
runs-on: ubuntu-latest
if: |
github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') ||
github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
steps:
- name: ποΈ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: π·οΈ Download Tag Artifact
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v4
with:
name: tag
path: .
continue-on-error: true
- name: π·οΈ Determine Tag Name
id: determine_tag
run: |
# Attempt to get tag from most recent tag creared (fallback)
TAG_NAME=$(git describe --tags --abbrev=0 2>/dev/null)
# If workflow was triggered by the tag workflow, use the new tag
if [ "$GITHUB_EVENT_NAME" == "workflow_run" ]; then
if [[ -n "${{ github.event.workflow_run.outputs.new_tag }}" ]]; then
TAG_NAME="${{ github.event.workflow_run.outputs.new_tag }}"
elif [[ -f tag.txt ]]; then
TAG_NAME=$(cat tag.txt)
fi
# If workflow was triggered by a push event, use the tag from the ref
elif [[ "$GITHUB_EVENT_NAME" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
TAG_NAME="${{ github.ref }}"
fi
echo "Using tag $TAG_NAME"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: π Check if release already exists
id: check_release
run: |
if [ -z "$TAG_NAME" ]; then
echo "No tag name found, skipping release check"
exit 1
fi
if gh release view "$TAG_NAME" > /dev/null 2>&1; then
echo "Release for tag $TAG_NAME already exists."
exit 1
else
echo "Tag is present, valid and no existing releases exist. Continuing with $TAG_NAME...."
fi
- name: π€ Download PDF artifact
uses: actions/download-artifact@v4
with:
name: resume-pdf
path: out/
- name: π€ Download Misc artifact
uses: actions/download-artifact@v4
with:
name: resume-misc-zip
path: .
- name: π Set up GitHub CLI
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: π Create GitHub Release
run: |
gh release create $TAG_NAME out/${{ env.PDF_NAME }} --title "Release $TAG_NAME" --notes "Generated CV PDF for release $TAG_NAME"
- name: π Upload assets to docs/ folder
run: |
mkdir -p docs-temp dl docs
mv ${{ env.MISC_NAME }} dl/resume.zip
unzip -o dl/${{ env.MISC_NAME }} -d docs-temp/
cp docs-temp/out/${{ env.PDF_NAME }} docs/cv.pdf
cp docs-temp/out/${{ env.HTML_NAME }} docs/index.html
rm -rf docs-temp dl
git config user.name "b68web"
git config user.email "[email protected]"
git add docs/
git commit -m "Add release $TAG_NAME"
git push origin HEAD:main