forgejo: initial ci
This commit is contained in:
commit
7e088230c5
2 changed files with 94 additions and 0 deletions
56
.forgejo/workflows/generate-tarball.yml
Normal file
56
.forgejo/workflows/generate-tarball.yml
Normal file
|
@ -0,0 +1,56 @@
|
|||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref_name:
|
||||
description: 'Tag or commit'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-tarball:
|
||||
name: Build tarball
|
||||
runs-on: x86_64
|
||||
container:
|
||||
image: alpine:latest
|
||||
env:
|
||||
CI_PROJECT_NAME: zotero
|
||||
steps:
|
||||
- name: Environment setup
|
||||
run: apk add nodejs git xz gzip dotnet6-sdk
|
||||
- name: Repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 500
|
||||
ref: ${{ inputs.ref_name }}
|
||||
- name: Package build
|
||||
run: |
|
||||
sed 's|<Exec Command="tar.*|<Exec Command="tar -cf $(TarballFilePath) -C $(TarballDir)/.. $([MSBuild]::MakeRelative($([System.IO.Path]::GetDirectoryName($(TarballDir))), $(TarballDir)))" />|' -i src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
|
||||
export _cli_root=/usr/lib/dotnet
|
||||
echo "Building dotnet-$CI_COMMIT_TAG tarball"
|
||||
_InitializeDotNetCli="$_cli_root" DOTNET_INSTALL_DIR="$_cli_root" DotNetBuildFromSource=true ./build.sh /p:ArcadeBuildTarball=true /p:EnableSourceLink=false /p:CheckEolTargetFramework=false /p:TarballDir=$(pwd)/dotnet-$CI_COMMIT_TAG /p:TarballFilePath=$(pwd)/dotnet-$CI_COMMIT_TAG.tar
|
||||
echo "Compressing dotnet-$CI_COMMIT_TAG.tar.xz"
|
||||
xz -T0 -9 -vv -e -c > ./dotnet-$CI_COMMIT_TAG.tar.xz < ./dotnet-$CI_COMMIT_TAG.tar
|
||||
echo "Generating sha512sum and sha256sum"
|
||||
sha512sum dotnet-$CI_COMMIT_TAG.tar.xz > dotnet-$CI_COMMIT_TAG.tar.xz.sha512sum
|
||||
sha256sum dotnet-$CI_COMMIT_TAG.tar.xz > dotnet-$CI_COMMIT_TAG.tar.xz.sha256sum
|
||||
- name: Package upload
|
||||
uses: forgejo/upload-artifact@v3
|
||||
with:
|
||||
name: tarball
|
||||
path: dotnet*
|
||||
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 findutils
|
||||
- name: Package download
|
||||
uses: forgejo/download-artifact@v3
|
||||
- name: Package deployment
|
||||
run: |
|
||||
find .
|
||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/zotero-${{ inputs.ref_name }}.tar.gz ${{ github.server_url }}/api/packages/mirrors/generic/zotero/${{ inputs.ref_name }}/zotero-${{ inputs.ref_name}}.tar.gz
|
||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/zotero-${{ inputs.ref_name }}.tar.gz.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/zotero/${{ inputs.ref_name }}/zotero-${{ inputs.ref_name}}.tar.gz.sha512sum
|
38
.forgejo/workflows/mirror-repository.yml
Normal file
38
.forgejo/workflows/mirror-repository.yml
Normal file
|
@ -0,0 +1,38 @@
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
schedule:
|
||||
- cron: '@hourly'
|
||||
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
mirror:
|
||||
name: Pull from upstream
|
||||
runs-on: x86_64
|
||||
container:
|
||||
image: 'docker.io/node:20-bookworm'
|
||||
steps:
|
||||
- name: git mirror branches {v*/,}main & tags
|
||||
run: |
|
||||
git init --bare .
|
||||
git remote add origin https://github.com/dotnet/installer
|
||||
git fetch origin refs/heads/main:refs/mirror/main
|
||||
git ls-remote origin refs/heads/v*/main | while read sha full_ref ; do
|
||||
ref=${full_ref#refs/heads/}
|
||||
git fetch origin $full_ref:refs/mirror/$ref
|
||||
tag=${ref%/main}
|
||||
git fetch origin refs/tags/${tag}*:refs/mirror-tags/${tag}*
|
||||
done
|
||||
if test "${{ vars.TEST }}" != true ; then
|
||||
token=${{ secrets.CODE_FORGEJO_TOKEN }}
|
||||
destination=${{ vars.DESTINATION }}
|
||||
owner=${{ vars.OWNER }}
|
||||
else
|
||||
token=${{ secrets.TEST_FORGEJO_TOKEN }}
|
||||
destination=${{ vars.TEST_DESTINATION }}
|
||||
owner=${{ vars.TEST_OWNER }}
|
||||
fi
|
||||
git push --force https://any:$token@$destination/$owner/dotnet-installer refs/mirror/*:refs/heads/* refs/mirror-tags/*:refs/tags/* --tags
|
Loading…
Reference in a new issue