table of contents numbers now start at correct page number (#234) #2
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: Release | |
on: | |
workflow_dispatch: ~ | |
push: | |
branches: [ master ] | |
jobs: | |
# Create a Release | |
create_release: | |
name: π Create Release | |
runs-on: ubuntu-latest | |
outputs: | |
release_exists: ${{ steps.check_release.outputs.release_exists }} | |
release_id: ${{ steps.check_release.outputs.release_id }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Check if release exists | |
id: check_release | |
run: | | |
release_name="${{ steps.date.outputs.date }}" | |
release_data=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${release_name}") | |
if [ "$release_id" != "null" ]; then | |
echo "release_exists=true" >> $GITHUB_OUTPUT | |
echo "release_id=$(echo $release_data | jq -r '.id')" >> $GITHUB_OUTPUT | |
else | |
echo "release_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Delete Existing Release | |
if: steps.check_release.outputs.release_exists == 'true' | |
run: | | |
curl -L \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.check_release.outputs.release_id }} | |
curl \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ steps.date.outputs.date }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.date.outputs.date }} | |
release_name: Amendment ${{ steps.date.outputs.date }} | |
draft: false | |
prerelease: false | |
upload_pdf: | |
name: π Upload PDF Copy | |
needs: create_release # Depends on release being created for upload URL | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install TexLive, TexLive formats-extra, Git, and Make | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y texlive texlive-formats-extra git make | |
- name: π¨ Build | |
run: | | |
make | |
- name: π₯οΈβ¬οΈ Upload Assets - New Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_name: Constitution.pdf | |
asset_path: ./constitution.pdf | |
asset_content_type: application/pdf | |