Skip to content

#17: use tag for release url io. temp release url #86

#17: use tag for release url io. temp release url

#17: use tag for release url io. temp release url #86

Workflow file for this run

name: Create Release
on:
workflow_dispatch:
inputs:
tags:
description: 'Version'
required: true
type: string
default: 'v'
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
version:
name: Compute Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Get tag from GITHUB_REF
id: github_ref
run: |
echo "::debug::GITHUB_REF=${GITHUB_REF}"
echo "PUSH_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Set release name based on originating event
id: get_version
run: |
echo "::debug::PUSH_TAG=${{steps.github_ref.outputs.PUSH_TAG}}"
echo "::debug::INPUT_VERSION=${{inputs.tags}}"
if [[ "${{github.event_name}}" == "workflow_dispatch" ]];
then computed_version="${{inputs.tags}}";
else computed_version="${{steps.github_ref.outputs.PUSH_TAG}}";
fi
echo "VERSION=$computed_version" >> $GITHUB_OUTPUT
echo "::debug::Version evaluated to $computed_version"
release:
name: Create Release for Version
needs: version
runs-on: ubuntu-latest
steps:
- name: Create draft release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.version.outputs.version }}
name: Release ${{ needs.version.outputs.version }}
draft: true
prerelease: true
generate_release_notes: true
- name: Echo release info
run: echo "::debug::Writing url=${{ steps.create_release.outputs.url }}; id=${{ steps.create_release.outputs.id }}; upload_url=${{ steps.create_release.outputs.upload_url }}"
- name: Checkout code
uses: actions/checkout@v3
- name: Echo cv-maxpowis-{version}.tex
run: echo "::debug::Writing '\def\releasenumber{${{ needs.version.outputs.version }}}\def\releaseurl{https://github.com/maxpowis/cv/releases/tag/${{ needs.version.outputs.version }}}\input{cv}' to cv-maxpowis-${{ needs.version.outputs.version }}.tex"
- name: Create cv-maxpowis-{version}.tex
uses: "finnp/create-file-action@2.0.0"
env:
FILE_NAME: "cv-maxpowis-${{ needs.version.outputs.version }}.tex"
FILE_DATA: '\def\releasenumber{${{ needs.version.outputs.version }}}\def\releaseurl{${{ steps.create_release.outputs.url }}}\input{cv}'
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
root_file: cv-maxpowis-${{ needs.version.outputs.version }}.tex
latexmk_use_lualatex: true
- name: Upload assets to release
id: update_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ needs.version.outputs.version }}
draft: false
files: |
cv-maxpowis-${{ needs.version.outputs.version }}.pdf
- name: Trigger workflow 'Publish PDF release to website'
uses: peter-evans/repository-dispatch@v2.1.1
if: ${{ github.event_name=='push' }}
with:
token: ${{ secrets.PERSONAL_TOKEN_REPO_WORKFLOW }}
event-type: dispatch_publish