From 22f47b98db96855f76affffda87cd3164e5df994 Mon Sep 17 00:00:00 2001 From: "forgejo-actions[bot]" Date: Mon, 9 Sep 2024 23:20:24 +0000 Subject: [PATCH] Inject custom workflow --- .forgejo/patches/ghc-9.8.patch | 18 +++++ .forgejo/workflows/generate-tarball.yml | 85 ++++++++++++++++++++++++ .forgejo/workflows/mirror-repository.yml | 50 ++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 .forgejo/patches/ghc-9.8.patch create mode 100644 .forgejo/workflows/generate-tarball.yml create mode 100644 .forgejo/workflows/mirror-repository.yml diff --git a/.forgejo/patches/ghc-9.8.patch b/.forgejo/patches/ghc-9.8.patch new file mode 100644 index 0000000000..85796d787d --- /dev/null +++ b/.forgejo/patches/ghc-9.8.patch @@ -0,0 +1,18 @@ +Support ghc-9.8 by widening a lot of constraints. + +This patch can be removed once upstream supports ghc 9.8 offically. + +diff -uprN git-annex-10.20240227.orig/cabal.project git-annex-10.20240227/cabal.project +--- git-annex-10.20240227.orig/cabal.project 1970-01-01 01:00:00.000000000 +0100 ++++ git-annex-10.20240227/cabal.project 2024-04-28 13:30:14.061706299 +0200 +@@ -0,0 +1,10 @@ ++packages: *.cabal ++ ++allow-newer: dav ++allow-newer: haskeline:filepath ++allow-newer: haskeline:directory ++allow-newer: xml-hamlet ++allow-newer: aws:filepath ++allow-newer: dbus:network ++allow-newer: dbus:filepath ++allow-newer: microstache:filepath diff --git a/.forgejo/workflows/generate-tarball.yml b/.forgejo/workflows/generate-tarball.yml new file mode 100644 index 0000000000..0d98abd451 --- /dev/null +++ b/.forgejo/workflows/generate-tarball.yml @@ -0,0 +1,85 @@ +on: + workflow_dispatch: + inputs: + ref_name: + description: 'Tag or commit' + required: true + type: string + + push: + tags: + - '*' + +jobs: + cabal-config-edge: + name: Generate cabal config for edge + runs-on: x86_64 + container: + image: alpine:edge + env: + CI_ALPINE_TARGET_RELEASE: edge + steps: + - name: Environment setup + run: apk add nodejs git cabal patch + - name: Repo pull + uses: actions/checkout@v4 + with: + fetch-depth: 1 + ref: ${{ inputs.ref_name }} + - name: Config generation + run: | + patch -p1 -i .forgejo/patches/ghc-9.8.patch + HOME="${{ github.workspace}}"/cabal_cache cabal update + HOME="${{ github.workspace}}"/cabal_cache cabal v2-freeze --shadow-installed-packages --strong-flags --flags="+assistant +webapp +pairing +production +torrentparser +magicmime +benchmark -debuglocks +dbus +networkbsd +gitlfs +httpclientrestricted" + mv cabal.project.freeze git-annex.config + - name: Package upload + uses: forgejo/upload-artifact@v3 + with: + name: cabalconfigedge + path: git-annex*.config + cabal-config-v320: + name: Generate cabal config for edge + runs-on: x86_64 + container: + image: alpine:3.20 + env: + CI_ALPINE_TARGET_RELEASE: v3.20 + steps: + - name: Environment setup + run: apk add nodejs git cabal patch + - name: Repo pull + uses: actions/checkout@v4 + with: + fetch-depth: 1 + ref: ${{ inputs.ref_name }} + - name: Config generation + run: | + patch -p1 -i .forgejo/patches/ghc-9.8.patch + HOME="${{ github.workspace }}"/cabal_cache cabal update + HOME="${{ github.workspace }}"/cabal_cache cabal v2-freeze --shadow-installed-packages --strong-flags --flags="+assistant +webapp +pairing +production +torrentparser +magicmime +benchmark -debuglocks +dbus +networkbsd +gitlfs +httpclientrestricted" + mv cabal.project.freeze git-annex.config + - name: Package upload + uses: forgejo/upload-artifact@v3 + with: + name: cabalconfig320 + path: git-annex*.config + upload-tarball: + name: Upload to generic repo + runs-on: x86_64 + needs: [cabal-config-edge,cabal-config-v320] + container: + image: alpine:latest + steps: + - name: Environment setup + run: apk add nodejs curl findutils + - name: Package download + uses: forgejo/download-artifact@v3 + - name: Package deployment + run: | + if test $GITHUB_REF_NAME == "ci" ; then + CI_REF_NAME=${{ inputs.ref_name }} + else + CI_REF_NAME=$GITHUB_REF_NAME + fi + curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./cabalconfigedge/git-annex.config ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/$CI_REF_NAME/git-annex-$CI_REF_NAME-edge.cabal + curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./cabalconfig320/git-annex.config ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/$CI_REF_NAME/git-annex-$CI_REF_NAME-v320.cabal diff --git a/.forgejo/workflows/mirror-repository.yml b/.forgejo/workflows/mirror-repository.yml new file mode 100644 index 0000000000..b820421db5 --- /dev/null +++ b/.forgejo/workflows/mirror-repository.yml @@ -0,0 +1,50 @@ +on: + workflow_dispatch: + + schedule: + - cron: '@hourly' + +jobs: + mirror: + name: Pull from upstream + runs-on: x86_64 + container: + image: alpine:latest + env: + upstream: https://git.joeyh.name/git/git-annex.git + tags: '10.2024*' + steps: + - name: Environment setup + run: apk add grep git sed coreutils bash nodejs + - name: Fetch destination + uses: actions/checkout@v4 + with: + fetch_depth: 1 + ref: ci + token: ${{ secrets.CODE_FORGEJO_TOKEN }} + - name: Missing tag detecting + run: | + git ls-remote $upstream "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > upstream_tags + git ls-remote ${{ github.server_url}}/${{ github.repository }} "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > destination_tags + cat upstream_tags destination_tags | tr ' ' '\n' | sort | uniq -u > missing_tags + echo "Missing tags:" + cat missing_tags + - name: Missing tag fetch + run: | + git remote add upstream $upstream + while read tag; do + git fetch upstream tag $tag --no-tags + done < missing_tags + - name: Packaging workflow injection + run: | + while read tag; do + git checkout $tag + git tag -d $tag + git checkout ci -- ./.forgejo + git config user.name "forgejo-actions[bot]" + git config user.email "dev@ayakael.net" + git commit -m 'Inject custom workflow' + git tag -a $tag -m $tag + done < missing_tags + - name: Push to destination + run: git push --force origin refs/tags/*:refs/tags/* --tags