|
1 | | -name: Generate PDFs |
| 1 | +name: Generate PDFs and Attach to Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: # Allows the workflow to be triggered manually |
@@ -27,22 +27,31 @@ jobs: |
27 | 27 | pandoc "$file" -o "pdf_output/$base_name.pdf" |
28 | 28 | done |
29 | 29 |
|
30 | | - # Optional: Upload PDFs as artifacts |
31 | | - - name: Upload PDFs as artifacts |
32 | | - uses: actions/upload-artifact@v3 |
| 30 | + # Step 4: Generate a dynamic tag |
| 31 | + - name: Generate Tag |
| 32 | + id: tag |
| 33 | + run: | |
| 34 | + TAG_NAME="v$(date +'%Y%m%d')-$(git rev-parse --short HEAD)" |
| 35 | + echo "tag_name=$TAG_NAME" >> $GITHUB_ENV |
| 36 | +
|
| 37 | + # Step 5: Create a release with the dynamic tag |
| 38 | + - name: Create Release |
| 39 | + id: create_release |
| 40 | + uses: actions/create-release@v1 |
33 | 41 | with: |
34 | | - name: generated-pdfs |
35 | | - path: pdf_output/ |
| 42 | + tag_name: ${{ env.tag_name }} |
| 43 | + release_name: "Generated PDFs Release - ${{ env.tag_name }}" |
| 44 | + draft: false |
| 45 | + prerelease: false |
| 46 | + env: |
| 47 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
36 | 48 |
|
37 | | - # Optional: Commit PDFs back to the repository |
38 | | - - name: Commit and push PDFs |
| 49 | + # Step 6: Upload each PDF to the release |
| 50 | + - name: Upload PDFs to Release |
39 | 51 | run: | |
40 | | - git config --global user.name "github-actions[bot]" |
41 | | - git config --global user.email "github-actions[bot]@users.noreply.github.com" |
42 | | - mkdir -p docs/pdf_output |
43 | | - mv pdf_output/* docs/pdf_output/ |
44 | | - git add docs/pdf_output |
45 | | - git commit -m "Add generated PDFs" |
46 | | - git push |
| 52 | + for pdf in pdf_output/*.pdf; do |
| 53 | + echo "Uploading $pdf" |
| 54 | + gh release upload ${{ env.tag_name }} "$pdf" |
| 55 | + done |
47 | 56 | env: |
48 | 57 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments