Skip to content

.github/workflows/main.yml #5

.github/workflows/main.yml

.github/workflows/main.yml #5

Workflow file for this run

on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v3
- name: Determine next edition
id: determine-edition
run: |
echo "EDITION=$(($(git describe --tags --abbrev=0) +1))" >> "$GITHUB_ENV"
- name: Check if edition exists
id: check-edition
run: |
if curl -I "https://mailchi.mp/hackernewsletter/$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 $EDITION
- name: Setup Tectonic
uses: WtfJoke/setup-tectonic@v2.1.1
with:
github-token: $EDITION
- name: Print Tectonic version
run: tectonic --version
- name: Run Tectonic
run: tectonic output.tex
- name: Rename output.pdf
run: mv output.pdf HackerNewsPaper-$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: $EDITION
name: "HackerNewsPaper #$EDITION"
body: "HackerNewsPaper #$EDITION"
artifacts: "HackerNewsPaper-$EDITION.pdf"
removeArtifacts: true