forked from bitfox-git/hackernewspaper
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 2.16 KB
/
main.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
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v3
- name: Fetch last tag
id: fetch-tag
run: echo "::set-output name=TAG::$(git describe --tags --abbrev=0)"
- name: Determine next edition
id: determine-edition
run: |
echo "::set-output name=EDITION::$(( ${TAG} + 1 ))"
- name: Check if edition exists
id: check-edition
run: |
if curl -I "https://mailchi.mp/hackernewsletter/${{ steps.determine-edition.outputs.EDITION }}" | grep -q "200 OK"; then
echo "Edition exists, continuing workflow."
else
echo "Edition does not exist, exiting workflow." && exit 1
fi
- name: Setup Python
uses: actions/setup-python@v4.7.0
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Setup Playwright
run: playwright install chromium
- name: Execute Python script
run: python generator.py ${{ steps.determine-edition.outputs.EDITION }}
- name: Setup Tectonic
uses: WtfJoke/setup-tectonic@v2.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Print Tectonic version
run: tectonic --version
- name: Run Tectonic
run: tectonic output.tex
- name: Rename output.pdf
run: mv output.pdf HackerNewsPaper-${{ steps.determine-edition.outputs.EDITION }}.pdf
- name: Upload a Build Artifact
if: always()
uses: actions/upload-artifact@v3.1.2
with:
path: ./*.*
- name: Create release
uses: ncipollo/release-action@v1.13.0
with:
allowUpdates: true
tag: ${{ steps.determine-edition.outputs.EDITION }}
name: "HackerNewsPaper #${{ steps.determine-edition.outputs.EDITION }}"
body: "HackerNewsPaper #${{ steps.determine-edition.outputs.EDITION }}"
artifacts: "HackerNewsPaper-${{ steps.determine-edition.outputs.EDITION }}.pdf"
removeArtifacts: true