Skip to content

Commit

Permalink
rf: Trigger compile release when tag complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Jul 29, 2024
1 parent 7f17dba commit 8bcf92c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
pull_request:
paths:
- 'tex/**'
workflow_run:
workflows: ["Tag"]
types:
- completed

env:
PDF_NAME: Alicia-Sykes-CV.pdf
Expand Down Expand Up @@ -49,12 +53,23 @@ jobs:
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
if: |
github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') ||
github.event_name == 'workflow_run' && startsWith(github.event.workflow_run.conclusion, 'success')
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v2

- name: 🏷️ Determine Tag Name
id: determine_tag
run: |
if [ "${{ github.event_name }}" = "workflow_run" ]; then
echo "TAG_NAME=${{ github.event.workflow_run.outputs.new_tag }}" >> $GITHUB_ENV
else
echo "TAG_NAME=${{ github.ref }}" >> $GITHUB_ENV
fi
- name: 📤 Download PDF artifact
uses: actions/download-artifact@v2
with:
Expand All @@ -67,9 +82,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: "Generated CV PDF for release ${{ github.ref }}"
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
body: "Generated CV PDF for release ${{ env.TAG_NAME }}"
draft: true
prerelease: false

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and Push Tag
name: Tag

on:
workflow_dispatch:
Expand All @@ -15,6 +15,8 @@ on:
jobs:
create_tag:
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.create_new_tag.outputs.new_tag }}
steps:
- name: 🛎️ Checkout Repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -62,6 +64,7 @@ jobs:
NEW_TAG=${{ env.NEW_TAG }}
DESCRIPTION="${{ github.event.inputs.description }}"
git tag -a "$NEW_TAG" -m "$DESCRIPTION"
echo "::set-output name=new_tag::$NEW_TAG"
- name: 🚀 Push New Tag
run: |
Expand Down

0 comments on commit 8bcf92c

Please sign in to comment.