dotnet-installer/.forgejo/workflows/generate-tarball.yml

56 lines
2.6 KiB
YAML

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:v3.20
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:v3.20
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