2024-08-10 22:40:35 +00:00
|
|
|
name: On_Push
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
paths:
|
|
|
|
- .forgejo/**/*
|
|
|
|
- Committee/**/Handovers/*
|
|
|
|
- Minutes/**/*
|
|
|
|
- Committee/**/Budget/*
|
|
|
|
- Events/**/*
|
|
|
|
# so we can manually build the artifacts
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2024-09-14 17:46:10 +00:00
|
|
|
changes:
|
|
|
|
runs-on: nix
|
|
|
|
# Required permissions
|
|
|
|
permissions:
|
|
|
|
pull-requests: read
|
|
|
|
# Set job outputs to values from filter step
|
|
|
|
outputs:
|
2024-09-14 18:06:09 +00:00
|
|
|
scripts: ${{ steps.filter.outputs.changes }}
|
2024-09-14 17:46:10 +00:00
|
|
|
steps:
|
2024-09-14 17:50:08 +00:00
|
|
|
# make sure the code is available
|
|
|
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
- uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v3
|
|
|
|
with:
|
|
|
|
repository: ${{ gitea.repository }}
|
|
|
|
ref_name: ${{ gitea.ref_name }}
|
2024-09-14 17:46:10 +00:00
|
|
|
# For pull requests it's not necessary to checkout the code
|
|
|
|
- uses: https://github.com/dorny/paths-filter@v3
|
|
|
|
id: filter
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
minutes:
|
|
|
|
- 'Minutes/**/*'
|
|
|
|
events:
|
|
|
|
- 'Events/**/*'
|
|
|
|
handovers:
|
|
|
|
- 'Committee/**/Handovers/*'
|
|
|
|
budgets:
|
|
|
|
- 'Committee/**/Budget/*'
|
|
|
|
|
2024-08-10 22:40:35 +00:00
|
|
|
# rust code must be formatted for standardisation
|
|
|
|
pdfs:
|
|
|
|
# build it using teh base nixos system, helps with caching
|
|
|
|
runs-on: nix
|
2024-09-14 17:46:10 +00:00
|
|
|
needs: changes
|
2024-08-10 22:40:35 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-09-14 18:06:09 +00:00
|
|
|
# script: [ handovers, minutes, budget, events ]
|
|
|
|
script: ${{ fromJSON(needs.changes.outputs.scripts) }}
|
2024-08-10 22:40:35 +00:00
|
|
|
permissions:
|
|
|
|
# needs this to create tags and releases
|
|
|
|
contents: write
|
|
|
|
steps:
|
2024-09-14 18:24:26 +00:00
|
|
|
- env:
|
|
|
|
OUTPUT1: ${{needs.changes.outputs.scripts}}
|
2024-09-14 18:25:45 +00:00
|
|
|
OUTPUT2: ${{ fromJSON(needs.changes.outputs.scripts) }}
|
2024-09-14 18:24:26 +00:00
|
|
|
run: echo "$OUTPUT1 $OUTPUT2"
|
2024-09-14 17:46:10 +00:00
|
|
|
# the if statements are to only run if there are changes in the sub dir
|
2024-08-10 22:40:35 +00:00
|
|
|
# get the repo first
|
2024-09-14 18:06:09 +00:00
|
|
|
- uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
- uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v3
|
2024-08-19 17:00:30 +00:00
|
|
|
with:
|
|
|
|
repository: ${{ gitea.repository }}
|
|
|
|
ref_name: ${{ gitea.ref_name }}
|
2024-08-10 22:40:35 +00:00
|
|
|
# actual script to run the build process
|
2024-09-14 18:06:09 +00:00
|
|
|
- run: nix run .#${{ matrix.script }}
|
2024-08-10 22:40:35 +00:00
|
|
|
# zip the files so they can be released
|
2024-09-14 18:06:09 +00:00
|
|
|
- run: |
|
2024-08-10 22:40:35 +00:00
|
|
|
mkdir releases
|
|
|
|
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
|
2024-09-14 18:06:09 +00:00
|
|
|
- uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1
|
2024-08-10 22:40:35 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.API_TOKEN_FORGEJO }}
|
|
|
|
direction: upload
|
|
|
|
release-dir: releases
|
|
|
|
url: https://forgejo.skynet.ie
|
|
|
|
repo: Computer_Society/open-goverance
|
|
|
|
title: "PDFs of ${{ matrix.script }}"
|
|
|
|
tag: "${{ matrix.script }}_latest"
|
|
|
|
# basically replace an existing release if it exists
|
|
|
|
override: true
|