From fafcc9048dfbc57544596012eced38aa208e7910 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sat, 10 Aug 2024 23:40:35 +0100 Subject: [PATCH] ci: switch over to using forgejo actions --- .forgejo/workflows/push.yaml | 52 +++++++++++++++++++++ .gitlab-ci.yml | 37 --------------- _scripts/format_budget.sh | 11 +++-- _scripts/format_events.sh | 17 +++---- _scripts/format_handovers.sh | 7 +-- _scripts/format_minutes.sh | 10 ++-- _scripts/md_toml/_Budget.md.toml | 2 +- _scripts/md_toml/_Events.md.toml | 2 +- _scripts/md_toml/_Handovers.md.toml | 2 +- _scripts/md_toml/_Minutes-Committee.md.toml | 2 +- _scripts/md_toml/_Minutes-Council.md.toml | 2 +- 11 files changed, 81 insertions(+), 63 deletions(-) create mode 100644 .forgejo/workflows/push.yaml delete mode 100644 .gitlab-ci.yml diff --git a/.forgejo/workflows/push.yaml b/.forgejo/workflows/push.yaml new file mode 100644 index 0000000..1376365 --- /dev/null +++ b/.forgejo/workflows/push.yaml @@ -0,0 +1,52 @@ +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 ] + script: [ budget ] + 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 }} + # upload the files +# - uses: https://code.forgejo.org/forgejo/upload-artifact@v4 +# with: +# name: ${{ matrix.script }} +# path: pdf_${{ matrix.script }}/ + - uses: https://forgejo.skynet.ie/Skynet/actions-forgejo-release@v1 + with: + token: ${{ secrets.API_TOKEN_FORGEJO }} + direction: upload + release-dir: pdf_${{ matrix.script }}/ + 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 + verbose: true + - if: always() + run: sleep 60m + shell: bash diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 48bcd78..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -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/**/* \ No newline at end of file diff --git a/_scripts/format_budget.sh b/_scripts/format_budget.sh index 1542518..becc001 100755 --- a/_scripts/format_budget.sh +++ b/_scripts/format_budget.sh @@ -2,9 +2,10 @@ root="$PWD" -folder="budget" -folder_html="html_${folder}" -folder_pdf="pdf_${folder}" +folder="Budget" +folder_lower="budget" +folder_html="html_${folder_lower}" +folder_pdf="pdf_${folder_lower}" function build_html() { # used to match ** @@ -46,10 +47,10 @@ function build_html() { rm -f .md.toml # make the final folder - mkdir -p "$root/$folder_html/$year_string" + mkdir -p "$root/$folder_html/${folder_html}" # copy everything to teh final folder - cp -R ./$folder_html/* "$root/$folder_html/$year_string" + cp -R ./$folder_html/* "$root/${folder_html}$year_string" # remove teh temp folder rm -rf "./$folder_html" diff --git a/_scripts/format_events.sh b/_scripts/format_events.sh index 6bfe607..52a0d9e 100755 --- a/_scripts/format_events.sh +++ b/_scripts/format_events.sh @@ -2,9 +2,10 @@ root="$PWD" -folder="events" -folder_html="html_${folder}" -folder_pdf="pdf_${folder}" +folder="Events" +folder_lower="events" +folder_html="html_${folder_lower}" +folder_pdf="pdf_${folder_lower}" function build_html() { # used to match ** @@ -34,20 +35,20 @@ function build_html() { cargo-bfom # 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 - rm -f ./${folder}_html/_template.md - rm -f ./${folder}_html/event.html + rm -f ./${folder_lower}_html/_template.md + rm -f ./${folder_lower}_html/event.html rm -f .md.toml # make the final folder mkdir -p "$root/$folder_html/$year_string" # 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 - rm -rf "./${folder}_html" + rm -rf "./${folder_lower}_html" # return to root cd "$root_html" diff --git a/_scripts/format_handovers.sh b/_scripts/format_handovers.sh index 979d10b..45df2b8 100755 --- a/_scripts/format_handovers.sh +++ b/_scripts/format_handovers.sh @@ -2,9 +2,10 @@ root="$PWD" -folder="handovers" -folder_html="html_${folder}" -folder_pdf="pdf_${folder}" +folder="Handovers" +folder_lower="handovers" +folder_html="html_${folder_lower}" +folder_pdf="pdf_${folder_lower}" function build_html() { # used to match ** diff --git a/_scripts/format_minutes.sh b/_scripts/format_minutes.sh index 437eb2b..d48c00f 100755 --- a/_scripts/format_minutes.sh +++ b/_scripts/format_minutes.sh @@ -3,7 +3,7 @@ root="$PWD" folder_html="html_minutes" -folder_pdf="pdf_Minutes" +folder_pdf="pdf_minutes" # make teh html files first function build_html() { @@ -40,14 +40,14 @@ function build_html() { rm -f .md.toml # create teh new folders where stuff is going to - mkdir -p "../../$folder_html/$year/Committee" - mkdir -p "../../$folder_html/$year/Council" + mkdir -p "../../$folder_html/${year}committee" + mkdir -p "../../$folder_html/${year}council" # iterate the files - for file in {Committee,Council}_html/*.html; do + for file in {committee,council}_html/*.html; do if [ -f "$file" ]; then stripped=''${file/_html/""} - cp $file "../../$folder_html/$year/$stripped" + cp $file "../../$folder_html/${year}$stripped" fi done # the temp folders where teh html was created, leaving these could cause ghost artifacts diff --git a/_scripts/md_toml/_Budget.md.toml b/_scripts/md_toml/_Budget.md.toml index 13720b3..d0c6121 100644 --- a/_scripts/md_toml/_Budget.md.toml +++ b/_scripts/md_toml/_Budget.md.toml @@ -9,7 +9,7 @@ indentation = 2 src = "./Budget" # Optional -dest= "./html_Budget" +dest= "./html_budget" # html blocks you dont want to include in teh finished page # Optional diff --git a/_scripts/md_toml/_Events.md.toml b/_scripts/md_toml/_Events.md.toml index 631b783..43ef21f 100644 --- a/_scripts/md_toml/_Events.md.toml +++ b/_scripts/md_toml/_Events.md.toml @@ -9,7 +9,7 @@ indentation = 2 src = "./AAAAAAA" # Optional -dest= "./Events_html" +dest= "./events_html" # html blocks you dont want to include in teh finished page # Optional diff --git a/_scripts/md_toml/_Handovers.md.toml b/_scripts/md_toml/_Handovers.md.toml index 4227cb3..8e381b7 100644 --- a/_scripts/md_toml/_Handovers.md.toml +++ b/_scripts/md_toml/_Handovers.md.toml @@ -9,7 +9,7 @@ indentation = 2 src = "./Handovers" # Optional -dest= "./html_Handovers" +dest= "./html_handovers" # html blocks you dont want to include in teh finished page # Optional diff --git a/_scripts/md_toml/_Minutes-Committee.md.toml b/_scripts/md_toml/_Minutes-Committee.md.toml index 09f3977..770fabf 100644 --- a/_scripts/md_toml/_Minutes-Committee.md.toml +++ b/_scripts/md_toml/_Minutes-Committee.md.toml @@ -9,7 +9,7 @@ indentation = 2 src = "./Committee" # Optional -dest= "./Committee_html" +dest= "./committee_html" # html blocks you dont want to include in teh finished page # Optional diff --git a/_scripts/md_toml/_Minutes-Council.md.toml b/_scripts/md_toml/_Minutes-Council.md.toml index 13d8934..3f3e5e7 100644 --- a/_scripts/md_toml/_Minutes-Council.md.toml +++ b/_scripts/md_toml/_Minutes-Council.md.toml @@ -9,7 +9,7 @@ indentation = 2 src = "./Council" # Optional -dest= "./Council_html" +dest= "./council_html" # html blocks you dont want to include in teh finished page # Optional