ci: pass artifact to release properly #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile LaTeX and Release PDF | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
compile_latex: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Compile LaTeX | |
uses: hspaans/latexmk-action@v1 | |
with: | |
format: pdf | |
filename: root.tex | |
- name: Upload compiled PDF as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: compiled-pdf | |
path: root.pdf | |
create_release: | |
needs: compile_latex | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Download compiled PDF artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: compiled-pdf | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d')" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.date.outputs.date }}-${{ github.run_number }} | |
release_name: | |
Release ${{ steps.date.outputs.date }}-${{ github.run_number }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: root.pdf | |
asset_name: robot-writeup-2024.pdf | |
asset_content_type: application/pdf |