Inject custom workflow
This commit is contained in:
parent
4d854e66b8
commit
43d66ef407
2 changed files with 125 additions and 0 deletions
75
.forgejo/workflows/generale-tarball.yml
Normal file
75
.forgejo/workflows/generale-tarball.yml
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
ref_name:
|
||||||
|
description: 'Tag or commit'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-tarball:
|
||||||
|
name: Build tarball w/ submodules
|
||||||
|
runs-on: x86_64
|
||||||
|
container:
|
||||||
|
image: alpine:3.19
|
||||||
|
env:
|
||||||
|
CI_PROJECT_NAME: papermc
|
||||||
|
ZSTD_LIMIT: 0
|
||||||
|
steps:
|
||||||
|
- name: Environment setup
|
||||||
|
run: apk add nodejs git openjdk21-jre-headless zstd tar
|
||||||
|
- name: Repo pull
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 500
|
||||||
|
ref: ${{ inputs.ref_name }}
|
||||||
|
path: papermc
|
||||||
|
- name: Package build
|
||||||
|
run: |
|
||||||
|
if test $GITHUB_REF_NAME == "ci" ; then
|
||||||
|
CI_REF_NAME=${{ inputs.ref_name }}
|
||||||
|
else
|
||||||
|
CI_REF_NAME=$GITHUB_REF_NAME
|
||||||
|
fi
|
||||||
|
echo "building tarball for $CI_REF_NAME"
|
||||||
|
cd $CI_PROJECT_NAME
|
||||||
|
git config --global user.name "forgejo-actions[bot]"
|
||||||
|
git config --global user.email "dev@ayakael.net"
|
||||||
|
./gradlew --parallel applyPatches
|
||||||
|
cd ../
|
||||||
|
mv $CI_PROJECT_NAME $CI_PROJECT_NAME-$CI_REF_NAME
|
||||||
|
echo "Generating tarball.."
|
||||||
|
tar -cf $CI_PROJECT_NAME-$CI_REF_NAME.tar --exclude-backups --exclude-caches-all --warning=no-file-changed $CI_PROJECT_NAME-$CI_REF_NAME
|
||||||
|
echo "Compressing $CI_PROJECT_NAME-$CI_REF_NAME.tar.zst"
|
||||||
|
zstd --auto-threads=logical --ultra --long -22 -T"$ZSTD_LIMIT" -vv $CI_PROJECT_NAME-$CI_REF_NAME.tar -o $CI_PROJECT_NAME-$CI_REF_NAME.tar.zst
|
||||||
|
echo "Generating sha512sum"
|
||||||
|
sha512sum $CI_PROJECT_NAME-$CI_REF_NAME.tar.zst > $CI_PROJECT_NAME-$CI_REF_NAME.tar.zst.sha512sum
|
||||||
|
- name: Package upload
|
||||||
|
uses: forgejo/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: tarball
|
||||||
|
path: papermc-*.tar*
|
||||||
|
upload-tarball:
|
||||||
|
name: Upload to generic repo
|
||||||
|
runs-on: x86_64
|
||||||
|
needs: [build-tarball]
|
||||||
|
container:
|
||||||
|
image: alpine:latest
|
||||||
|
steps:
|
||||||
|
- name: Environment setup
|
||||||
|
run: apk add nodejs curl
|
||||||
|
- 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 ./tarball/papermc-*.tar.zst ${{ github.server_url }}/api/packages/mirrors/generic/papermc/$CI_REF_NAME/papermc-$CI_REF_NAME.tar.zst
|
||||||
|
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/papermc-*.tar.zst.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/papermc/$CI_REF_NAME/papermc-$CI_REF_NAME.tar.zst.sha512sum
|
50
.forgejo/workflows/mirror-repository.yml
Normal file
50
.forgejo/workflows/mirror-repository.yml
Normal file
|
@ -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://github.com/PaperMC/Paper
|
||||||
|
tags: '1.2*'
|
||||||
|
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
|
Loading…
Add table
Add a link
Reference in a new issue