Skip to content

Commit

Permalink
Merge pull request #11 from BMCV/current
Browse files Browse the repository at this point in the history
Update CI from current
  • Loading branch information
kostrykin committed Feb 16, 2024
2 parents 6e5612d + 56581f4 commit 4cf51fe
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 26 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set update schedule for GitHub Actions

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
76 changes: 51 additions & 25 deletions .github/workflows/build_assignments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,18 @@ jobs:

fetch_sources:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref_name == 'current' || startsWith(github.ref_name, 'future-')
steps:

- name: Initialize
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Upload sources
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: sources
path: assignments

delete_previous_release:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:

- name: Delete previous release (if any)
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
delete_release: true

build_document_parts:
runs-on: ubuntu-latest
needs: ['fetch_sources']
Expand All @@ -46,28 +35,28 @@ jobs:
steps:

- name: Download sources
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Build LaTeX document parts
uses: xu-cheng/latex-action@v2
uses: xu-cheng/latex-action@v3
with:
root_file: ${{ matrix.part }}.tex
working_directory: sources

- name: Upload LaTeX document part
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.part }}
path: sources/${{ matrix.part }}.pdf

merge_document_parts:
runs-on: ubuntu-latest
needs: ['build_document_parts', 'delete_previous_release']
if: github.event_name != 'pull_request'
needs: ['build_document_parts']
permissions: write-all
steps:

- name: Download sources and LaTeX document parts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Prepare directory structure
run: |
Expand All @@ -77,10 +66,48 @@ jobs:
done
- name: Build LaTeX document
uses: xu-cheng/latex-action@v2
uses: xu-cheng/latex-action@v3
with:
root_file: main.tex
root_file: assignments.tex
working_directory: sources

- name: Upload LaTeX document
uses: actions/upload-artifact@v4
id: document-upload-step
with:
name: document
path: sources/assignments.pdf

- name: Paste document download link into pull request
uses: actions/github-script@v3
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Document built successfully: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.document-upload-step.outputs.artifact-id }}'
})
publish_document:
runs-on: ubuntu-latest
needs: ['merge_document_parts']
if: github.event_name != 'pull_request'
steps:

- name: Delete previous release (if any)
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
delete_release: true

- name: Download document
uses: actions/download-artifact@v4
with:
name: document

- name: Create release
id: create_release
Expand All @@ -94,12 +121,11 @@ jobs:
prerelease: false

- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: sources/main.pdf
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assignments.pdf
asset_name: assignments.pdf
asset_content_type: pdf
2 changes: 1 addition & 1 deletion .github/workflows/create_future_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:

- name: Initialize
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Create and initialize future branch
run: echo "branch=$(python .github/create-future-branch.py)" >> $GITHUB_OUTPUT
Expand Down
File renamed without changes.

0 comments on commit 4cf51fe

Please sign in to comment.