-
Notifications
You must be signed in to change notification settings - Fork 8
79 lines (69 loc) · 2.9 KB
/
Copy pathmain.yml
File metadata and controls
79 lines (69 loc) · 2.9 KB
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
name: Typst Build and Publish
on:
push:
tags:
- 'v*.*.*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_typst:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v7
- name: Setup Typst
uses: typst-community/setup-typst@v5
- name: Ensure yq is available
run: |
if ! command -v yq &> /dev/null; then
sudo wget -qO /usr/local/bin/yq \
https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
fi
- name: Prepare metadata.yml
env:
CV_NAME: ${{ secrets.CV_NAME }}
CV_EMAIL: ${{ secrets.CV_EMAIL }}
CV_PHONE: ${{ secrets.CV_PHONE }}
CV_LOCATION: ${{ secrets.CV_LOCATION }}
CV_GITHUB_USERNAME: ${{ secrets.CV_GITHUB_USERNAME }}
CV_LINKEDIN_USERNAME: ${{ secrets.CV_LINKEDIN_USERNAME }}
CV_WEBSITE: ${{ secrets.CV_WEBSITE }}
run: |
mv example.metadata.yml metadata.yml
yq -i '
.name = strenv(CV_NAME) |
.email = strenv(CV_EMAIL) |
.phone = strenv(CV_PHONE) |
.location = strenv(CV_LOCATION) |
.githubUsername = strenv(CV_GITHUB_USERNAME) |
.linkedinUsername = strenv(CV_LINKEDIN_USERNAME) |
.website = strenv(CV_WEBSITE)
' metadata.yml
# Set the 'NAME' variable in the 'Secrets and Variables' section of your 'Actions' settings
- name: Compile Typst to PDF
if: success()
run: typst c main.typ ${{ secrets.NAME }}_Resume.pdf
- name: Check output (after rename)
run: ls
- name: Release
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
files: ${{ secrets.NAME }}_Resume.pdf
- name: Notify if CV was compiled successfully
if: success()
run: |
curl \
-H $"Title: CV ${{ github.ref_name }} published successfully" \
-H "X-Tags: memo, CV, version-update, updated-link" \
-H "Content-Type: text/plain" \
-d $'CV ${{ github.ref_name }} published successfully.\nYou can find the updated CV at https://github.com/${{ github.repository }}/releases/latest/download/${{ secrets.NAME }}_Resume.pdf\nStatus: ${{job.status}}' \
${{ vars.NTFY_GACTIONS_URL }}
- name: Removes older releases
uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 3 # Keeps only the last 'n' releases
keep-old-minor-releases: false # Keeps the latest release for any older versions