-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (80 loc) · 2.58 KB
/
pdf.yaml
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
name: PDF Generation
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
push:
branches:
- main
pull_request: {}
jobs:
get-changed-files:
name: Get Changed Files
runs-on: ubuntu-20.04
outputs:
changed-files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get list of all changes
uses: tj-actions/changed-files@v26
id: changed-files
build-pdf:
name: Build Resume PDF
runs-on: ubuntu-22.04
needs: [get-changed-files]
if: contains(needs.get-changed-files.outputs.changed-files, 'src/Resume.svg')
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Export resume SVG to PDF
uses: docker://docker.io/minidocks/inkscape
with:
args: src/Resume.svg --export-filename=Resume.pdf
- name: Upload Artifact to Job
uses: actions/upload-artifact@v3
with:
name: Resume.pdf
path: Resume.pdf
publish-pdf:
name: Publish Resume PDF
runs-on: ubuntu-22.04
needs: [build-pdf]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Bump PDF Version
id: bump-version
run: |
new_version="$(./.github/scripts/bump_version.sh)"
echo "::set-output name=new-version::$new_version"
- name: Create Release
uses: release-drafter/release-drafter@v5
id: create-release
with:
tag: ${{ steps.bump-version.outputs.new-version }}
name: ${{ steps.bump-version.outputs.new-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Artifact from Previous Job
uses: actions/download-artifact@v3
with:
name: Resume.pdf
- name: Upload Release Asset
run: |
mv Resume.pdf Resume-${{ steps.bump-version.outputs.new-version }}.pdf
until gh release view ${{ steps.bump-version.outputs.new-version }}; do
echo "Release ${{ steps.bump-version.outputs.new-version }} not found. Waiting 1 second until checking again..."
sleep 1
done
gh release upload ${{ steps.bump-version.outputs.new-version }} Resume-${{ steps.bump-version.outputs.new-version }}.pdf
- name: Publish Release
run: gh release edit ${{ steps.bump-version.outputs.new-version }} --draft=false