Skip to content

Merge pull request #10 from MRC-CSO-SPHSU/dependabot/github_actions/a… #14

Merge pull request #10 from MRC-CSO-SPHSU/dependabot/github_actions/a…

Merge pull request #10 from MRC-CSO-SPHSU/dependabot/github_actions/a… #14

Workflow file for this run

name: Build and Release PDF
on:
push:
tags:
- '*.*.*'
env:
FILE: main
OUT_DIR: github_artifacts
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0 # First step for `git log` to match local history, removes `grafted`
- name: Add post-checkout git hook
run: |
cp ./gitinfo2/post-xxx-sample.txt ./.git/hooks/post-xxx-hook
chmod 755 ./.git/hooks/post-xxx-hook
- name: Fix HEAD position
run: |
git switch master # Checkout leaves the HEAD detached, this step fixes the issue
- name: Trigger git hook
run: |
./.git/hooks/post-xxx-hook
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v3
with:
root_file: ${{ env.FILE }}.tex
- name: Move artifacts to dedicated directory
run: mkdir -p ${{ env.OUT_DIR }} && mv ${{ env.FILE }}.pdf ./${{ env.OUT_DIR }}/
- name: Upload pdf as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILE }}.pdf
path: ./${{ env.OUT_DIR }}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
name: Release ${{ github.ref_name }}
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v2
with:
files: |
./${{ env.OUT_DIR }}/${{ env.FILE }}.pdf
append_body: True
name: Release ${{ github.ref_name }}
deploy:
needs: [build] # Add other jobs if needed
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ${{ env.OUT_DIR }}
- name: Move artifacts to deploy directory
run: mkdir -p github_deploy && mv ${{ env.OUT_DIR }}/*/* github_deploy
- name: Deploy on orphan branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./github_deploy
publish_branch: build
force_orphan: true