ci: seeing if we can avoid rebuilding everythign on push
This commit is contained in:
parent
0c9d383c34
commit
b268102ab0
1 changed files with 41 additions and 5 deletions
|
@ -14,10 +14,40 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
changes:
|
||||||
|
runs-on: nix
|
||||||
|
# Required permissions
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
# Set job outputs to values from filter step
|
||||||
|
outputs:
|
||||||
|
forgejo: ${{ steps.filter.outputs.forgejo }}
|
||||||
|
minutes: ${{ steps.filter.outputs.minutes }}
|
||||||
|
events: ${{ steps.filter.outputs.events }}
|
||||||
|
handovers: ${{ steps.filter.outputs.handovers }}
|
||||||
|
budget: ${{ steps.filter.outputs.budgets }}
|
||||||
|
steps:
|
||||||
|
# For pull requests it's not necessary to checkout the code
|
||||||
|
- uses: https://github.com/dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
forgejo:
|
||||||
|
- '.forgejo/**/*'
|
||||||
|
minutes:
|
||||||
|
- 'Minutes/**/*'
|
||||||
|
events:
|
||||||
|
- 'Events/**/*'
|
||||||
|
handovers:
|
||||||
|
- 'Committee/**/Handovers/*'
|
||||||
|
budgets:
|
||||||
|
- 'Committee/**/Budget/*'
|
||||||
|
|
||||||
# rust code must be formatted for standardisation
|
# rust code must be formatted for standardisation
|
||||||
pdfs:
|
pdfs:
|
||||||
# build it using teh base nixos system, helps with caching
|
# build it using teh base nixos system, helps with caching
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
|
needs: changes
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
script: [ handovers, minutes, budget, events ]
|
script: [ handovers, minutes, budget, events ]
|
||||||
|
@ -25,20 +55,26 @@ jobs:
|
||||||
# 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
|
||||||
# get the repo first
|
# get the repo first
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
- if: ${{ needs.changes.outputs.${{ matrix.script }} == 'true' }}
|
||||||
- uses: https://forgejo.skynet.ie/Skynet/actions-deploy-to-skynet/get_lfs@v3
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
- if: ${{ needs.changes.outputs.${{ matrix.script }} == 'true' }}
|
||||||
|
uses: https://forgejo.skynet.ie/Skynet/actions-deploy-to-skynet/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
|
||||||
- run: nix run .#${{ matrix.script }}
|
- if: ${{ needs.changes.outputs.${{ matrix.script }} == 'true' }}
|
||||||
|
run: nix run .#${{ matrix.script }}
|
||||||
# zip the files so they can be released
|
# zip the files so they can be released
|
||||||
- run: |
|
- if: ${{ needs.changes.outputs.${{ matrix.script }} == 'true' }}
|
||||||
|
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
|
||||||
- uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1
|
- if: ${{ needs.changes.outputs.${{ matrix.script }} == 'true' }}
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue