name: Build and Release

on:
  push:
    tags:
      - 'v*'
  schedule:
    - cron: '@monthly'

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: alpine:latest
      options: --user root
    steps:
      - run: apk add --no-cache nodejs nix
      - name: Checkout code
        uses: actions/checkout@v4
      - run: nix-channel --add https://nixos.org/channels/nixpkgs-stable && nix-channel --update
      - run: nix-shell -p biber tectonic --run "tectonic Main.tex"

      - name: Create Release
        uses: https://github.com/softprops/action-gh-release@v2
        with:
          files: Main.pdf