papermc/.forgejo/workflows/generale-tarball.yml

71 lines
2.6 KiB
YAML
Raw Normal View History

2024-12-10 16:50:30 +00:00
on:
workflow_dispatch:
inputs:
ref_name:
description: 'Tag or commit'
required: true
type: string
jobs:
build-tarball:
name: Build tarball w/ submodules
runs-on: x86_64
container:
2024-12-10 18:10:42 +00:00
image: alpine:3.19
2024-12-10 16:50:30 +00:00
env:
CI_PROJECT_NAME: papermc
steps:
- name: Environment setup
2024-12-10 18:10:42 +00:00
run: apk add nodejs git openjdk21-jre-headless gzip
2024-12-10 16:50:30 +00:00
- name: Repo pull
uses: actions/checkout@v4
with:
fetch-depth: 500
ref: ${{ inputs.ref_name }}
2024-12-10 18:12:32 +00:00
path: papermc
2024-12-10 16:50:30 +00:00
- 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"
2024-12-10 18:10:42 +00:00
cd $CI_PROJECT_NAME
2024-12-10 18:16:18 +00:00
git config user.name "forgejo-actions[bot]"
git config user.email "dev@ayakael.net"
2024-12-10 18:10:42 +00:00
./gradlew --parallel applyPatches
cd ../
mv $CI_PROJECT_NAME $CI_PROJECT_NAME-$CI_REF_NAME
msg "generating tarball.."
tar -cf $CI_PROJECT_NAME-$CI_REF_NAME.tar --exclude-backups --exclude-caches-all --exclude-vcs $CI_PROJECT_NAME-$CI_REF_NAME
echo "Compressing $CI_PROJECT_NAME-$CI_REF_NAME.tar.xz"
xz -T0 -9 -vv -e -c > ./$CI_PROJECT_NAME-$CI_REF_NAME.tar.xz < ./$CI_PROJECT_NAME-$CI_REF_NAME.tar
2024-12-10 16:50:30 +00:00
echo "Generating sha512sum"
sha512sum $CI_PROJECT_NAME-$CI_REF_NAME.tar.gz > $CI_PROJECT_NAME-$CI_REF_NAME.tar.gz.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.gz ${{ github.server_url }}/api/packages/mirrors/generic/papermc/$CI_REF_NAME/papermc-$CI_REF_NAME.tar.gz
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/papermc-*.tar.gz.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/papermc/$CI_REF_NAME/papermc-$CI_REF_NAME.tar.gz.sha512sum