ci: switch over to using forgejo actions

This commit is contained in:
silver 2024-08-10 23:40:35 +01:00
parent b3d2b83fed
commit d05ec2f214
Signed by untrusted user: silver
GPG key ID: 0A1071E702CE4B4E
12 changed files with 80 additions and 71 deletions

View file

@ -0,0 +1,47 @@
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:
# rust code must be formatted for standardisation
pdfs:
# build it using teh base nixos system, helps with caching
runs-on: nix
strategy:
matrix:
script: [ handovers, minutes, budget, events ]
permissions:
# needs this to create tags and releases
contents: write
steps:
# get the repo first
- uses: https://code.forgejo.org/actions/checkout@v4
# actual script to run the build process
- run: nix run .#${{ matrix.script }}
# zip the files so they can be released
- run: |
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
- uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1
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

View file

@ -1,37 +0,0 @@
stages:
- build
pdf:
tags:
- nix
before_script:
# basic stuff
- nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#bash
# setup the cache stuff
- nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#attic-client
- attic login skynet https://nix-cache.skynet.ie/ $CACHE_KEY
- attic use skynet-cache
stage: build
# what it runs
script:
- attic watch-store skynet-cache &
- nix --extra-experimental-features 'nix-command flakes' run .#handovers
- nix --extra-experimental-features 'nix-command flakes' run .#minutes
- nix --extra-experimental-features 'nix-command flakes' run .#budget
- nix --extra-experimental-features 'nix-command flakes' run .#events
artifacts:
name: "PDFs"
paths:
- pdf_Handovers/
- pdf_Minutes/
- pdf_Budget/
- pdf_Events/
- errors.log
rules:
- if: '$CI_PROJECT_NAMESPACE == "compsoc1/compsoc" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
changes:
- Committee/**/Handovers/*
- Minutes/**/*
- Committee/**/Budget/*
- Events/**/*

View file

@ -9,24 +9,20 @@ Pipelines run and generate these files every time they are modified.
### Handovers ### Handovers
Latest handovers are available here: Latest handovers are available here:
* [Download][0] * [Download][0]
* [Browse][1]
These can be generated with ``nix run .#handovers`` These can be generated with ``nix run .#handovers``
### Minutes ### Minutes
Latest Minutes are available here: Latest Minutes are available here:
* [Download][0] * [Download][1]
* [Browse][2]
### Events ### Events
Latest Events are available here: Latest Events are available here:
* [Download][0] * [Download][2]
* [Browse][3]
These can be generated with ``nix run .#minutes`` These can be generated with ``nix run .#minutes``
[0]: https://gitlab.skynet.ie/api/v4/projects/57/jobs/artifacts/main/download?job=pdf [0]: https://forgejo.skynet.ie/Computer_Society/open-goverance/releases/tag/handovers_latest
[1]: https://gitlab.skynet.ie/compsoc1/compsoc/open-goverance/-/jobs/artifacts/main/browse/pdf_Handovers?job=pdf [1]: https://forgejo.skynet.ie/Computer_Society/open-goverance/releases/tag/minutes_latest
[2]: https://gitlab.skynet.ie/compsoc1/compsoc/open-goverance/-/jobs/artifacts/main/browse/pdf_Minutes?job=pdf [2]: https://forgejo.skynet.ie/Computer_Society/open-goverance/releases/tag/events_latest
[3]: https://gitlab.skynet.ie/compsoc1/compsoc/open-goverance/-/jobs/artifacts/main/browse/pdf_Events?job=pdf

View file

@ -2,9 +2,10 @@
root="$PWD" root="$PWD"
folder="budget" folder="Budget"
folder_html="html_${folder}" folder_lower="budget"
folder_pdf="pdf_${folder}" folder_html="html_${folder_lower}"
folder_pdf="pdf_${folder_lower}"
function build_html() { function build_html() {
# used to match ** # used to match **

View file

@ -2,9 +2,10 @@
root="$PWD" root="$PWD"
folder="events" folder="Events"
folder_html="html_${folder}" folder_lower="events"
folder_pdf="pdf_${folder}" folder_html="html_${folder_lower}"
folder_pdf="pdf_${folder_lower}"
function build_html() { function build_html() {
# used to match ** # used to match **
@ -34,20 +35,20 @@ function build_html() {
cargo-bfom cargo-bfom
# copy in teh relevent files # copy in teh relevent files
cp -R _Templates/* "./${folder}_html" cp -R _Templates/* "./${folder_lower}_html"
# no need to have the template in the output # no need to have the template in the output
rm -f ./${folder}_html/_template.md rm -f ./${folder_lower}_html/_template.md
rm -f ./${folder}_html/event.html rm -f ./${folder_lower}_html/event.html
rm -f .md.toml rm -f .md.toml
# make the final folder # make the final folder
mkdir -p "$root/$folder_html/$year_string" mkdir -p "$root/$folder_html/$year_string"
# copy everything to teh final folder # copy everything to teh final folder
cp -R ./${folder}_html/* "$root/$folder_html/$year_string" cp -R ./${folder_lower}_html/* "$root/$folder_html/$year_string"
# remove teh temp folder # remove teh temp folder
rm -rf "./${folder}_html" rm -rf "./${folder_lower}_html"
# return to root # return to root
cd "$root_html" cd "$root_html"

View file

@ -2,9 +2,10 @@
root="$PWD" root="$PWD"
folder="handovers" folder="Handovers"
folder_html="html_${folder}" folder_lower="handovers"
folder_pdf="pdf_${folder}" folder_html="html_${folder_lower}"
folder_pdf="pdf_${folder_lower}"
function build_html() { function build_html() {
# used to match ** # used to match **

View file

@ -3,7 +3,7 @@
root="$PWD" root="$PWD"
folder_html="html_minutes" folder_html="html_minutes"
folder_pdf="pdf_Minutes" folder_pdf="pdf_minutes"
# make teh html files first # make teh html files first
function build_html() { function build_html() {
@ -40,14 +40,14 @@ function build_html() {
rm -f .md.toml rm -f .md.toml
# create teh new folders where stuff is going to # create teh new folders where stuff is going to
mkdir -p "../../$folder_html/$year/Committee" mkdir -p "../../$folder_html/${year}committee"
mkdir -p "../../$folder_html/$year/Council" mkdir -p "../../$folder_html/${year}council"
# iterate the files # iterate the files
for file in {Committee,Council}_html/*.html; do for file in {committee,council}_html/*.html; do
if [ -f "$file" ]; then if [ -f "$file" ]; then
stripped=''${file/_html/""} stripped=''${file/_html/""}
cp $file "../../$folder_html/$year/$stripped" cp $file "../../$folder_html/${year}$stripped"
fi fi
done done
# the temp folders where teh html was created, leaving these could cause ghost artifacts # the temp folders where teh html was created, leaving these could cause ghost artifacts

View file

@ -9,7 +9,7 @@ indentation = 2
src = "./Budget" src = "./Budget"
# Optional # Optional
dest= "./html_Budget" dest= "./html_budget"
# html blocks you dont want to include in teh finished page # html blocks you dont want to include in teh finished page
# Optional # Optional

View file

@ -9,7 +9,7 @@ indentation = 2
src = "./AAAAAAA" src = "./AAAAAAA"
# Optional # Optional
dest= "./Events_html" dest= "./events_html"
# html blocks you dont want to include in teh finished page # html blocks you dont want to include in teh finished page
# Optional # Optional

View file

@ -9,7 +9,7 @@ indentation = 2
src = "./Handovers" src = "./Handovers"
# Optional # Optional
dest= "./html_Handovers" dest= "./html_handovers"
# html blocks you dont want to include in teh finished page # html blocks you dont want to include in teh finished page
# Optional # Optional

View file

@ -9,7 +9,7 @@ indentation = 2
src = "./Committee" src = "./Committee"
# Optional # Optional
dest= "./Committee_html" dest= "./committee_html"
# html blocks you dont want to include in teh finished page # html blocks you dont want to include in teh finished page
# Optional # Optional

View file

@ -9,7 +9,7 @@ indentation = 2
src = "./Council" src = "./Council"
# Optional # Optional
dest= "./Council_html" dest= "./council_html"
# html blocks you dont want to include in teh finished page # html blocks you dont want to include in teh finished page
# Optional # Optional