Update .gitea/workflows/mainRelease.yaml
Some checks failed
Build and Release LaTeX Book / build-and-release (push) Failing after 9m37s
Some checks failed
Build and Release LaTeX Book / build-and-release (push) Failing after 9m37s
This commit is contained in:
@@ -10,36 +10,52 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install LaTeX and Pandoc
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y texlive-full pandoc
|
||||
sudo apt install -y texlive-full pandoc curl jq
|
||||
|
||||
- name: Compile PDF from LaTeX
|
||||
run: |
|
||||
pdflatex -interaction=nonstopmode FullBook.tex
|
||||
pdflatex -interaction=nonstopmode FullBook.tex
|
||||
continue-on-error: false
|
||||
|
||||
- name: Convert to EPUB using Pandoc
|
||||
- name: Convert to EPUB
|
||||
run: |
|
||||
pandoc FullBook.tex -o FullBook.epub --toc --pdf-engine=xelatex
|
||||
|
||||
- name: Get commit SHA
|
||||
id: commit
|
||||
- name: Get short commit hash
|
||||
id: vars
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create pre-release with artifacts
|
||||
uses: https://gitea.com/actions/release@v1
|
||||
with:
|
||||
files: |
|
||||
FullBook.pdf
|
||||
FullBook.epub
|
||||
tag: alpha-${{ steps.commit.outputs.sha_short }}
|
||||
title: Commit ${{ steps.commit.outputs.sha_short }}
|
||||
prerelease: true
|
||||
- name: Create Release via Gitea API
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASETOKEN }}
|
||||
RELEASETOKEN: ${{ secrets.RELEASETOKEN }}
|
||||
run: |
|
||||
TAG="alpha-${{ steps.vars.outputs.sha_short }}"
|
||||
TITLE="Commit $TAG"
|
||||
API_URL="http://gitea.lan/api/v1/repos/imrayya/ScifiBook/releases"
|
||||
JSON=$(jq -n \
|
||||
--arg tag_name "$TAG" \
|
||||
--arg target "main" \
|
||||
--arg name "$TITLE" \
|
||||
'{tag_name: $tag_name, target_commitish: $target, name: $name, prerelease: true}')
|
||||
curl -X POST -H "Authorization: token $RELEASETOKEN" -H "Content-Type: application/json" \
|
||||
-d "$JSON" "$API_URL"
|
||||
|
||||
- name: Upload PDF and EPUB to Release
|
||||
env:
|
||||
RELEASETOKEN: ${{ secrets.RELEASETOKEN }}
|
||||
run: |
|
||||
TAG="alpha-${{ steps.vars.outputs.sha_short }}"
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token $RELEASETOKEN" \
|
||||
"http://gitea.lan/api/v1/repos/imrayya/ScifiBook/releases/tags/$TAG" | jq .id)
|
||||
|
||||
for file in FullBook.pdf FullBook.epub; do
|
||||
curl -X POST -H "Authorization: token $RELEASETOKEN" \
|
||||
-F "attachment=@$file" \
|
||||
"http://gitea.lan/api/v1/repos/imrayya/ScifiBook/releases/$RELEASE_ID/assets"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user