Build release branches (#2941)

update cicd to build release branches
This commit is contained in:
SoftFever 2023-11-30 23:58:52 +08:00 committed by GitHub
parent 82fe9beb57
commit 2f3ec2ab7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 22 deletions

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- main
- release/*
paths:
- 'deps/**'
- 'src/**'
@ -16,6 +17,7 @@ on:
pull_request:
branches:
- main
- release/*
paths:
- 'deps/**'
- 'src/**'

View File

@ -29,7 +29,14 @@ jobs:
- name: Get the version and date on Ubuntu and macOS
if: inputs.os != 'windows-latest'
run: |
ver=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
ver="nightly$(date +'%y%m%d')"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
ver="PR${{ github.event.number }}"
else
ver=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
ver=V$ver
fi
echo "ver=$ver" >> $GITHUB_ENV
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
shell: bash
@ -37,16 +44,28 @@ jobs:
- name: Get the version and date on Windows
if: inputs.os == 'windows-latest'
run: |
echo "date=$(Get-Date -Format 'yyyyMMdd')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
# Extract the version from the file
$versionContent = Get-Content version.inc -Raw
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
$ver = $matches[1]
$date = Get-Date -Format 'yyyyMMdd'
$ref = "${{ github.ref }}"
$eventName = "${{ github.event_name }}"
$prNumber = "${{ github.event.number }}"
if ($ref -eq 'refs/heads/main') {
$ver = "nightly" + $date.Substring(2)
} elseif ($eventName -eq 'pull_request') {
$ver = "PR" + $prNumber
} else {
$versionContent = Get-Content version.inc -Raw
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
$ver = $matches[1]
}
ver = "V$ver"
}
echo "ver=$ver" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "date: ${{ env.date }} version: $ver"
echo "date=$date" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "date: ${{ env.date }} version: ${{ env.ver }}"
shell: pwsh
- name: load cached deps
uses: actions/cache@v3
with:
@ -88,25 +107,25 @@ jobs:
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $P12_PASSWORD $KEYCHAIN_PATH
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer/OrcaSlicer.app
ln -s /Applications ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer -ov -format UDZO OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer -ov -format UDZO OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
xcrun notarytool store-credentials "notarytool-profile" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}"
xcrun notarytool submit "OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg
xcrun notarytool submit "OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
- name: Create DMG without notary
if: github.ref != 'refs/heads/main' && inputs.os == 'macos-12'
working-directory: ${{ github.workspace }}
run: |
ln -s /Applications ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer -ov -format UDZO OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer -ov -format UDZO OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
- name: Upload artifacts mac
if: inputs.os == 'macos-12'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg
name: OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
# Windows
- name: setup MSVC
@ -134,26 +153,26 @@ jobs:
if: inputs.os == 'windows-latest'
working-directory: ${{ github.workspace }}/build
shell: cmd
run: '"C:/Program Files/7-Zip/7z.exe" a -tzip OrcaSlicer_Windows_V${{ env.ver }}_portable.zip ${{ github.workspace }}/build/OrcaSlicer'
run: '"C:/Program Files/7-Zip/7z.exe" a -tzip OrcaSlicer_Windows_${{ env.ver }}_portable.zip ${{ github.workspace }}/build/OrcaSlicer'
- name: Pack PDB
if: inputs.os == 'windows-latest'
working-directory: ${{ github.workspace }}/build/src/Release
shell: cmd
run: '"C:/Program Files/7-Zip/7z.exe" a -m0=lzma2 -mx9 Debug_PDB_V${{ env.ver }}_for_developers_only.7z *.pdb'
run: '"C:/Program Files/7-Zip/7z.exe" a -m0=lzma2 -mx9 Debug_PDB_${{ env.ver }}_for_developers_only.7z *.pdb'
- name: Upload artifacts Win zip
if: inputs.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Windows_V${{ env.ver }}_portable
path: ${{ github.workspace }}/build/OrcaSlicer_Windows_V${{ env.ver }}_portable.zip
name: OrcaSlicer_Windows_${{ env.ver }}_portable
path: ${{ github.workspace }}/build/OrcaSlicer_Windows_${{ env.ver }}_portable.zip
- name: Upload artifacts Win installer
if: inputs.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Windows_V${{ env.ver }}
name: OrcaSlicer_Windows_${{ env.ver }}
path: ${{ github.workspace }}/build/OrcaSlicer*.exe
- name: Upload artifacts Win PDB
@ -161,7 +180,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: PDB
path: ${{ github.workspace }}/build/src/Release/Debug_PDB_V${{ env.ver }}_for_developers_only.7z
path: ${{ github.workspace }}/build/src/Release/Debug_PDB_${{ env.ver }}_for_developers_only.7z
# Ubuntu
- name: Install dependencies
@ -195,5 +214,5 @@ jobs:
if: inputs.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Linux_V${{ env.ver }}
name: OrcaSlicer_Linux_${{ env.ver }}
path: './build/OrcaSlicer_ubu64.AppImage'