Skip to content

Commit

Permalink
ci: release.yml only runs on push
Browse files Browse the repository at this point in the history
  • Loading branch information
youwen5 authored Mar 17, 2024
1 parent bc4ab73 commit 6f54bbd
Showing 1 changed file with 8 additions and 29 deletions.
37 changes: 8 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,43 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
compile_latex:
build_and_release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

- 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 }}
release_name: Release ${{ steps.date.outputs.date }}-${{ github.run_number }}
draft: false
prerelease: false

- name: Upload Release Asset
id: 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_path: ./root.pdf
asset_name: robot-writeup-2024.pdf
asset_content_type: application/pdf

0 comments on commit 6f54bbd

Please sign in to comment.