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

71 lines
3.2 KiB
YAML
Raw Permalink Normal View History

2024-08-12 06:13:49 +00:00
on:
workflow_dispatch:
inputs:
ref_name:
description: 'Tag or commit'
required: true
type: string
push:
tags:
- '*'
2024-08-12 06:13:49 +00:00
jobs:
build-tarball:
name: Build tarball
runs-on: x86_64
container:
2024-09-09 19:19:47 +00:00
image: alpine:3.19
2024-08-12 06:13:49 +00:00
steps:
- name: Environment setup
2024-09-09 16:48:18 +00:00
run: apk add nodejs git xz gzip dotnet6-sdk dotnet7-sdk sed bash
2024-08-12 06:13:49 +00:00
- name: Repo pull
uses: actions/checkout@v4
with:
fetch-depth: 500
ref: ${{ inputs.ref_name }}
- 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
2024-08-12 06:13:49 +00:00
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_REF_NAME 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_REF_NAME /p:TarballFilePath=$(pwd)/dotnet-$CI_REF_NAME.tar
echo "Compressing dotnet-$CI_REF_NAME.tar.xz"
xz -T0 -9 -vv -e -c > ./dotnet-$CI_REF_NAME.tar.xz < ./dotnet-$CI_REF_NAME.tar
2024-08-12 06:13:49 +00:00
echo "Generating sha512sum and sha256sum"
sha512sum dotnet-$CI_REF_NAME.tar.xz > dotnet-$CI_REF_NAME.tar.xz.sha512sum
sha256sum dotnet-$CI_REF_NAME.tar.xz > dotnet-$CI_REF_NAME.tar.xz.sha256sum
2024-08-12 06:13:49 +00:00
- name: Package upload
uses: forgejo/upload-artifact@v3
with:
name: tarball
path: dotnet*.tar.*
retention-days: 1 day
2024-08-12 06:13:49 +00:00
upload-tarball:
name: Upload to generic repo
runs-on: x86_64
needs: [build-tarball]
container:
2024-09-09 12:38:39 +00:00
image: alpine:latest
2024-08-12 06:13:49 +00:00
steps:
- name: Environment setup
2024-09-09 12:38:39 +00:00
run: apk add nodejs curl findutils
2024-08-12 06:13:49 +00:00
- name: Package download
uses: forgejo/download-artifact@v3
- name: Package deployment
run: |
2024-09-10 00:07:56 +00:00
if test $GITHUB_REF_NAME == "ci" ; then
CI_REF_NAME=${{ inputs.ref_name }}
else
CI_REF_NAME=$GITHUB_REF_NAME
fi
2024-09-10 00:47:53 +00:00
echo "Uploading to ${{ github.server.url }}/api/packages/mirrors/generic/dotnet/$CI_REF_NAME/dotnet-$CI_REF_NAME.tar.xz"
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/dotnet-*.tar.xz ${{ github.server_url }}/api/packages/mirrors/generic/dotnet/$CI_REF_NAME/dotnet-$CI_REF_NAME.tar.xz
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/dotnet-*.tar.xz.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/dotnet/$CI_REF_NAME/dotnet-$CI_REF_NAME.tar.xz.sha512sum
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/dotnet-*.tar.xz.sha256sum ${{ github.server_url }}/api/packages/mirrors/generic/dotnet/$CI_REF_NAME/dotnet-$CI_REF_NAME.tar.xz.sha256sum