Release #22
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: | |
env: | |
CONTAINER_TAG: maya/build_document:test | |
CONTAINER_SOURCE_PATH: /opt/source | |
CONTAINER_BUILD_PATH: /opt/source/build | |
CONTAINER_MAIN_PATH: main.tex | |
DOCUMENT_NAME: "Maya Hieroglyphs - The History of Decipherment" | |
SOURCE_BUNDLE_NAME: sources.zip | |
jobs: | |
create_release_draft: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Bundle sources | |
run: zip -r ${{ env.SOURCE_BUNDLE_NAME }} . -x ".git/*" ".github/*" | |
- name: Set up Docker buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build Docker container | |
uses: docker/build-push-action@v2 | |
with: | |
context: container | |
load: true | |
tags: ${{ env.CONTAINER_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Compile document | |
run: >- | |
docker run --rm | |
-v $GITHUB_WORKSPACE:${{ env.CONTAINER_SOURCE_PATH }} | |
-v $GITHUB_WORKSPACE/build:${{ env.CONTAINER_BUILD_PATH }} | |
${{ env.CONTAINER_TAG }} | |
pwsh -Command "${{ env.CONTAINER_SOURCE_PATH }}/Compile-Document.ps1 | |
-SourcePath \"${{ env.CONTAINER_SOURCE_PATH }}\" | |
-BuildPath \"${{ env.CONTAINER_BUILD_PATH}}\" | |
-DocumentName \"${{ env.DOCUMENT_NAME }}\" | |
-TexFile \"${{ env.CONTAINER_MAIN_PATH }}\"" | |
- name: Determine version | |
run: >- | |
echo "RELEASE_VERSION= | |
$(docker run --rm | |
-v $GITHUB_WORKSPACE:${{ env.CONTAINER_SOURCE_PATH }} | |
${{ env.CONTAINER_TAG }} | |
pwsh -Command "${{ env.CONTAINER_SOURCE_PATH }}/Edit-DocumentVersion.ps1 | |
-VersionTexPath ${{ env.CONTAINER_SOURCE_PATH }}/document-version.tex | |
-LongCount | |
")" | |
>> $GITHUB_ENV | |
- name: Create tag | |
run: | | |
git tag ${{ env.RELEASE_VERSION }} HEAD | |
git push origin ${{ env.RELEASE_VERSION }} | |
- name: Create release draft | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true | |
prerelease: false | |
name: Release ${{ env.RELEASE_VERSION }} | |
tag: $${{ env.RELEASE_VERSION }} | |
bodyFile: CHANGELOG.md | |
artifacts: "build/${{ env.DOCUMENT_NAME }}.pdf, ${{ env.SOURCE_BUNDLE_NAME }}" | |