This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
Bump chia-dotnet from 2.1.9 to 3.2.0 in /DlMirrorSync #74
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
tags: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runtime: [win-x64, linux-x64, osx-x64, linux-arm64] | |
runs-on: windows-2019 | |
env: | |
SRC: "DlMirrorSync" | |
NAME: "DlMirrorSync" | |
FRAMEWORK: "net8.0" | |
VERSION: "0.2.2" | |
OUTPUT_ROOT: "./publish" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Build project | |
run: dotnet publish ./${{ env.SRC }}/${{ env.NAME }}.csproj -c Release -r ${{ matrix.RUNTIME }} --framework ${{ env.FRAMEWORK }} --self-contained true /p:Version=${{ env.VERSION }} /p:PublishReadyToRun=true /p:PublishSingleFile=True /p:PublishTrimmed=false /p:IncludeNativeLibrariesForSelfExtract=True /p:PublishDir="bin\Release/${{ env.FRAMEWORK }}/${{ matrix.RUNTIME }}" --output ${{ env.OUTPUT_ROOT }}/standalone/${{ matrix.RUNTIME }} | |
- name: Setup Certificate | |
if: matrix.RUNTIME == 'win-x64' | |
run: | | |
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12 | |
cat /d/Certificate_pkcs12.p12 | |
shell: bash | |
- name: Set variables | |
if: matrix.RUNTIME == 'win-x64' | |
id: variables | |
run: | | |
echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" | |
echo "::set-output name=KEYPAIR_NAME::Key_454819080" | |
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV" | |
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV" | |
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV" | |
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV" | |
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH | |
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH | |
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH | |
echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH | |
shell: bash | |
- name: Setting up the client tools | |
if: matrix.RUNTIME == 'win-x64' | |
run: | | |
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/Keylockertools-windows-x64.msi/download?account_id=e94ff86e-6519-4598-a066-6b6b252245f0 -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi | |
msiexec /i smtools-windows-x64.msi /qn | |
shell: cmd | |
- name: Setup SSM KSP on windows latest | |
if: matrix.RUNTIME == 'win-x64' | |
run: | | |
curl -X GET https://stage.one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi | |
msiexec /i smtools-windows-x64.msi /quiet /qn | |
smksp_registrar.exe list | |
smctl.exe keypair ls | |
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user | |
smksp_cert_sync.exe | |
shell: cmd | |
- name: Signing using Signtool | |
if: matrix.RUNTIME == 'win-x64' | |
run: | | |
signtool.exe sign /sha1 ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${{ env.OUTPUT_ROOT }}\standalone\${{ matrix.RUNTIME }}\${{ env.NAME }}.exe | |
- name: Signtool verify | |
if: matrix.RUNTIME == 'win-x64' | |
run: | | |
signtool verify /v /pa ${{ env.OUTPUT_ROOT }}\standalone\${{ matrix.RUNTIME }}\${{ env.NAME }}.exe | |
shell: cmd | |
- name: Setup WiX | |
if: matrix.RUNTIME == 'win-x64' | |
run: dotnet tool install -g wix; wix extension add -g WixToolset.UI.wixext | |
- name: Build installer | |
if: matrix.RUNTIME == 'win-x64' | |
working-directory: ./MsiInstaller | |
run: dotnet build MsiInstaller.wixproj -c Release -r win-x64 --output ../${{ env.OUTPUT_ROOT }} | |
- name: Signing WinInstaller using Signtool | |
if: matrix.RUNTIME == 'win-x64' | |
working-directory: ${{ env.OUTPUT_ROOT }}/en-us | |
run: | | |
signtool.exe sign /sha1 ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ./${{ env.NAME }}-service-win-x64.msi | |
- name: Signtool verify WinInstaller | |
if: matrix.RUNTIME == 'win-x64' | |
working-directory: ${{ env.OUTPUT_ROOT }}/en-us | |
run: | | |
signtool verify /v /pa ./${{ env.NAME }}-service-win-x64.msi | |
shell: cmd | |
- name: Upload installer | |
uses: actions/upload-artifact@v3 | |
if: matrix.RUNTIME == 'win-x64' | |
with: | |
name: ${{ env.NAME }}-service-${{ matrix.RUNTIME }}.msi | |
path: ${{ env.OUTPUT_ROOT }}/en-us/*.msi | |
- name: output artifact name | |
id: artifact-name | |
run: | | |
echo "::set-output name=artifact_name::${{ env.NAME }}-${{ matrix.RUNTIME }}" | |
- name: Upload binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.NAME }}-${{ matrix.RUNTIME }} | |
path: ${{ env.OUTPUT_ROOT }}/standalone/${{ matrix.RUNTIME }}/* | |
debs: | |
env: | |
SRC: "DlMirrorSync" | |
NAME: "DlMirrorSync" | |
FRAMEWORK: "net8.0" | |
VERSION: "0.2.2" | |
OUTPUT_ROOT: "./publish" | |
name: Build ${{ matrix.name }} deb | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
strategy: | |
matrix: | |
include: | |
- name: datalayer-storage-mirror-sync-linux-x64 | |
os: linux-x64 # this must match the out-path directory in package.json | |
platform: amd64 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Download Linux artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.NAME }}-linux-x64 | |
path: ${{ matrix.name }}/linux-x64 | |
- name: files | |
working-directory: ${{ matrix.name }}/linux-x64 | |
run: ls -al | |
shell: bash | |
- name: Get tag name | |
id: tag-name | |
run: | | |
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | |
- name: Build .deb | |
env: | |
DATALAYER_STORAGE_UPLOADER_VERSION: ${{ steps.tag-name.outputs.TAGNAME }} | |
PLATFORM: ${{ matrix.platform }} | |
run: | | |
pip install j2cli | |
CLI_DEB_BASE="datalayer-storage-mirror-sync_${{ steps.tag-name.outputs.TAGNAME }}-1_${PLATFORM}" | |
mkdir -p "deb/$CLI_DEB_BASE/opt/datalayer-storage-mirror-sync" | |
mkdir -p "deb/$CLI_DEB_BASE/usr/bin" | |
mkdir -p "deb/$CLI_DEB_BASE/etc/systemd/system" | |
mkdir -p "deb/$CLI_DEB_BASE/DEBIAN" | |
j2 -o "deb/$CLI_DEB_BASE/DEBIAN/control" build-scripts/deb/control.j2 | |
cp -r ${{ matrix.name }}/${{ matrix.os }} "deb/$CLI_DEB_BASE/opt/datalayer-storage-mirror-sync/datalayer-storage-mirror-sync" | |
cp build-scripts/deb/datalayer-storage-mirror-sync@.service deb/$CLI_DEB_BASE/etc/systemd/system/datalayer-storage-mirror-sync@.service | |
chmod +x deb/$CLI_DEB_BASE/opt/datalayer-storage-mirror-sync/datalayer-storage-mirror-sync | |
ln -s ../../opt/datalayer-storage-mirror-sync/datalayer-storage-mirror-sync "deb/$CLI_DEB_BASE/usr/bin/datalayer-storage-mirror-sync" | |
dpkg-deb --build --root-owner-group "deb/$CLI_DEB_BASE" | |
- name: Upload deb | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}-deb | |
path: ${{ github.workspace }}/deb/*.deb | |
release_deb: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- debs | |
- build | |
strategy: | |
matrix: | |
include: | |
- name: datalayer-storage-mirror-sync-linux-x64 | |
os: linux-x64 # this must match the out-path directory in package.json | |
platform: amd64 | |
steps: | |
- uses: chrislennon/action-aws-cli@v1.1 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- name: Download Linux x64 deb | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ matrix.name }}-deb # Adjust the matrix name as per your configuration | |
path: ${{ matrix.name }}-deb | |
- name: Get tag name | |
id: tag-name | |
run: echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | |
- name: Upload to S3 with checksum | |
run: | | |
for deb_file in ${{ matrix.name }}-deb/*.deb; do | |
if [ -f "$deb_file" ]; then | |
deb_checksum=$(md5sum "$deb_file" | cut -d ' ' -f 1) | |
aws s3 cp "$deb_file" s3://dlaas/releases/ --metadata md5="$deb_checksum" | |
aws s3 cp "$deb_file" s3://dlaas/releases/${{ matrix.name }}-deb-latest.deb --metadata md5="$deb_checksum" | |
fi | |
done | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' | |
release_windows: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [win-x64] | |
env: | |
SRC: "DlMirrorSync" | |
NAME: "DlMirrorSync" | |
FRAMEWORK: "net8.0" | |
VERSION: "0.2.2" | |
OUTPUT_ROOT: "./publish" | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build | |
steps: | |
- uses: chrislennon/action-aws-cli@v1.1 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- name: Download Windows artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.NAME }}-${{ matrix.RUNTIME }} | |
path: ${{ env.OUTPUT_ROOT }}/standalone/${{ matrix.RUNTIME }}/ | |
- name: Download Windows Installer | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.NAME }}-service-${{ matrix.RUNTIME }}.msi | |
path: . | |
- name: Get tag name | |
id: tag-name | |
run: echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | |
- name: Upload to S3 with checksum | |
run: | | |
winInstallerFile=${{ env.NAME }}-service-win-x64.msi | |
winInstallerChecksum=$(md5sum "$winInstallerFile" | cut -d ' ' -f 1) | |
aws s3 cp "$winInstallerFile" s3://dlaas/releases/${{ env.NAME }}-${{ env.VERSION }}-service-win-x64-${{ steps.tag-name.outputs.TAGNAME }}.msi --metadata md5="$winInstallerChecksum" | |
aws s3 cp "$winInstallerFile" s3://dlaas/releases/${{ env.NAME }}-${{ env.VERSION }}-service-win-x64-latest.msi --metadata md5="$winInstallerChecksum" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-east-1" |