ci: actually read the documentation and turns out ye can do things smarter

This commit is contained in:
silver 2024-09-14 19:06:09 +01:00
parent 0e453f4118
commit 6c9a608fe6
Signed by untrusted user: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -21,11 +21,7 @@ jobs:
pull-requests: read pull-requests: read
# Set job outputs to values from filter step # Set job outputs to values from filter step
outputs: outputs:
forgejo: ${{ steps.filter.outputs.forgejo }} scripts: ${{ steps.filter.outputs.changes }}
minutes: ${{ steps.filter.outputs.minutes }}
events: ${{ steps.filter.outputs.events }}
handovers: ${{ steps.filter.outputs.handovers }}
budget: ${{ steps.filter.outputs.budgets }}
steps: steps:
# make sure the code is available # make sure the code is available
- uses: https://code.forgejo.org/actions/checkout@v4 - uses: https://code.forgejo.org/actions/checkout@v4
@ -38,8 +34,6 @@ jobs:
id: filter id: filter
with: with:
filters: | filters: |
forgejo:
- '.forgejo/**/*'
minutes: minutes:
- 'Minutes/**/*' - 'Minutes/**/*'
events: events:
@ -56,31 +50,27 @@ jobs:
needs: changes needs: changes
strategy: strategy:
matrix: matrix:
script: [ handovers, minutes, budget, events ] # script: [ handovers, minutes, budget, events ]
script: ${{ fromJSON(needs.changes.outputs.scripts) }}
permissions: permissions:
# needs this to create tags and releases # needs this to create tags and releases
contents: write contents: write
steps: steps:
# the if statements are to only run if there are changes in the sub dir # the if statements are to only run if there are changes in the sub dir
# get the repo first # get the repo first
- if: ${{ format('needs.changes.outputs.{0}', matrix.script) == 'true' }} - uses: https://code.forgejo.org/actions/checkout@v4
uses: https://code.forgejo.org/actions/checkout@v4 - uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v3
- if: ${{ format('needs.changes.outputs.{0}', matrix.script) == 'true' }}
uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v3
with: with:
repository: ${{ gitea.repository }} repository: ${{ gitea.repository }}
ref_name: ${{ gitea.ref_name }} ref_name: ${{ gitea.ref_name }}
# actual script to run the build process # actual script to run the build process
- if: ${{ format('needs.changes.outputs.{0}', matrix.script) == 'true' }} - run: nix run .#${{ matrix.script }}
run: nix run .#${{ matrix.script }}
# zip the files so they can be released # zip the files so they can be released
- if: ${{ format('needs.changes.outputs.{0}', matrix.script) == 'true' }} - run: |
run: |
mkdir releases mkdir releases
zip -r releases/${{ matrix.script }}.zip pdf_${{ matrix.script }} zip -r releases/${{ matrix.script }}.zip pdf_${{ matrix.script }}
# upload them so they are available at https://forgejo.skynet.ie/Computer_Society/open-goverance/releases/tag/minutes_latest # upload them so they are available at https://forgejo.skynet.ie/Computer_Society/open-goverance/releases/tag/minutes_latest
- if: ${{ format('needs.changes.outputs.{0}', matrix.script) == 'true' }} - uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1
uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1
with: with:
token: ${{ secrets.API_TOKEN_FORGEJO }} token: ${{ secrets.API_TOKEN_FORGEJO }}
direction: upload direction: upload