From dd6bc96691a325722f830d67421b072b2a7a8f5d Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sat, 14 Sep 2024 20:15:55 +0100 Subject: [PATCH] ci: test splitting it up into several different workflows --- .forgejo/actions/build-release-pdf/action.yml | 42 +++++++++++++++++++ .forgejo/workflows/push.yaml | 3 +- .forgejo/workflows/push_minutes.yaml | 28 +++++++++++++ Minutes/2024-2025/Committee/2024-09-13.md | 2 +- 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 .forgejo/actions/build-release-pdf/action.yml create mode 100644 .forgejo/workflows/push_minutes.yaml diff --git a/.forgejo/actions/build-release-pdf/action.yml b/.forgejo/actions/build-release-pdf/action.yml new file mode 100644 index 0000000..d7abfc1 --- /dev/null +++ b/.forgejo/actions/build-release-pdf/action.yml @@ -0,0 +1,42 @@ +name: 'Build and Release PDF' +description: 'Build and release the PDFs in teh Open Governance repo' +inputs: + repository: + description: 'Pass in gitea.repository' + required: true + ref_name: + description: 'Pass in gitea.ref_name' + required: true + token: + description: 'Pass in secrets.API_TOKEN_FORGEJO' + required: true + script: + description: 'The script we want to run' + required: true +runs: + using: "composite" + steps: + # get the repo first + - uses: https://code.forgejo.org/actions/checkout@v4 + - uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v3 + with: + repository: ${{ inputs.repository }} + ref_name: ${{ inputs.ref_name }} + # actual script to run the build process + - run: nix run .#${{ inputs.script }} + # zip the files so they can be released + - run: | + mkdir releases + zip -r releases/${{ inputs.script }}.zip pdf_${{ inputs.script }} + # upload them so they are available at https://forgejo.skynet.ie/Computer_Society/open-goverance/releases/tag/minutes_latest + - uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1 + with: + token: ${{ inputs.token }} + direction: upload + release-dir: releases + url: https://forgejo.skynet.ie + repo: Computer_Society/open-goverance + title: "PDFs of ${{ inputs.script }}" + tag: "${{ inputs.script }}_latest" + # basically replace an existing release if it exists + override: true \ No newline at end of file diff --git a/.forgejo/workflows/push.yaml b/.forgejo/workflows/push.yaml index 811dc44..f5eec79 100644 --- a/.forgejo/workflows/push.yaml +++ b/.forgejo/workflows/push.yaml @@ -7,7 +7,6 @@ on: paths: - .forgejo/**/* - Committee/**/Handovers/* - - Minutes/**/* - Committee/**/Budget/* - Events/**/* # so we can manually build the artifacts @@ -20,7 +19,7 @@ jobs: runs-on: nix strategy: matrix: - script: [ handovers, minutes, budget, events ] + script: [ handovers, budget, events ] permissions: # needs this to create tags and releases contents: write diff --git a/.forgejo/workflows/push_minutes.yaml b/.forgejo/workflows/push_minutes.yaml new file mode 100644 index 0000000..27c7785 --- /dev/null +++ b/.forgejo/workflows/push_minutes.yaml @@ -0,0 +1,28 @@ +name: On_Push + +on: + push: + branches: + - 'main' + paths: + - .forgejo/**/* + - Minutes/**/* + # so we can manually build the artifacts + workflow_dispatch: + +jobs: + # rust code must be formatted for standardisation + pdfs: + # build it using teh base nixos system, helps with caching + runs-on: nix + permissions: + # needs this to create tags and releases + contents: write + steps: + - name: Use local action + uses: ./.forgejo/actions/build-release-pdf + with: + repository: ${{ gitea.repository }} + ref_name: ${{ gitea.ref_name }} + token: ${{ secrets.API_TOKEN_FORGEJO }} + script: "minutes" diff --git a/Minutes/2024-2025/Committee/2024-09-13.md b/Minutes/2024-2025/Committee/2024-09-13.md index c104153..53e0aa6 100644 --- a/Minutes/2024-2025/Committee/2024-09-13.md +++ b/Minutes/2024-2025/Committee/2024-09-13.md @@ -101,4 +101,4 @@ Milan and co want to give a presentation on Microsoft #### 1st year wants to promote a class discord -Approved without any issue. \ No newline at end of file +Approved without any issue.