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: push:
branches: branches:
- main - main
- release/*
paths: paths:
- 'deps/**' - 'deps/**'
- 'src/**' - 'src/**'
@ -16,6 +17,7 @@ on:
pull_request: pull_request:
branches: branches:
- main - main
- release/*
paths: paths:
- 'deps/**' - 'deps/**'
- 'src/**' - 'src/**'

View File

@ -29,7 +29,14 @@ jobs:
- name: Get the version and date on Ubuntu and macOS - name: Get the version and date on Ubuntu and macOS
if: inputs.os != 'windows-latest' if: inputs.os != 'windows-latest'
run: | 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 "ver=$ver" >> $GITHUB_ENV
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
shell: bash shell: bash
@ -37,14 +44,26 @@ jobs:
- name: Get the version and date on Windows - name: Get the version and date on Windows
if: inputs.os == 'windows-latest' if: inputs.os == 'windows-latest'
run: | run: |
echo "date=$(Get-Date -Format 'yyyyMMdd')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 $date = Get-Date -Format 'yyyyMMdd'
# Extract the version from the file $ref = "${{ github.ref }}"
$versionContent = Get-Content version.inc -Raw $eventName = "${{ github.event_name }}"
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') { $prNumber = "${{ github.event.number }}"
$ver = $matches[1]
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 "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 shell: pwsh
- name: load cached deps - name: load cached deps
@ -88,25 +107,25 @@ jobs:
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $P12_PASSWORD $KEYCHAIN_PATH 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 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 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
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 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 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 notarytool submit "OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg xcrun stapler staple OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
- name: Create DMG without notary - name: Create DMG without notary
if: github.ref != 'refs/heads/main' && inputs.os == 'macos-12' if: github.ref != 'refs/heads/main' && inputs.os == 'macos-12'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |
ln -s /Applications ${{ github.workspace }}/build_${{inputs.arch}}/OrcaSlicer/Applications 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 - name: Upload artifacts mac
if: inputs.os == 'macos-12' if: inputs.os == 'macos-12'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }} name: OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_${{inputs.arch}}_V${{ env.ver }}.dmg path: ${{ github.workspace }}/OrcaSlicer_Mac_${{inputs.arch}}_${{ env.ver }}.dmg
# Windows # Windows
- name: setup MSVC - name: setup MSVC
@ -134,26 +153,26 @@ jobs:
if: inputs.os == 'windows-latest' if: inputs.os == 'windows-latest'
working-directory: ${{ github.workspace }}/build working-directory: ${{ github.workspace }}/build
shell: cmd 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 - name: Pack PDB
if: inputs.os == 'windows-latest' if: inputs.os == 'windows-latest'
working-directory: ${{ github.workspace }}/build/src/Release working-directory: ${{ github.workspace }}/build/src/Release
shell: cmd 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 - name: Upload artifacts Win zip
if: inputs.os == 'windows-latest' if: inputs.os == 'windows-latest'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: OrcaSlicer_Windows_V${{ env.ver }}_portable name: OrcaSlicer_Windows_${{ env.ver }}_portable
path: ${{ github.workspace }}/build/OrcaSlicer_Windows_V${{ env.ver }}_portable.zip path: ${{ github.workspace }}/build/OrcaSlicer_Windows_${{ env.ver }}_portable.zip
- name: Upload artifacts Win installer - name: Upload artifacts Win installer
if: inputs.os == 'windows-latest' if: inputs.os == 'windows-latest'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: OrcaSlicer_Windows_V${{ env.ver }} name: OrcaSlicer_Windows_${{ env.ver }}
path: ${{ github.workspace }}/build/OrcaSlicer*.exe path: ${{ github.workspace }}/build/OrcaSlicer*.exe
- name: Upload artifacts Win PDB - name: Upload artifacts Win PDB
@ -161,7 +180,7 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: PDB 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 # Ubuntu
- name: Install dependencies - name: Install dependencies
@ -195,5 +214,5 @@ jobs:
if: inputs.os == 'ubuntu-20.04' if: inputs.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: OrcaSlicer_Linux_V${{ env.ver }} name: OrcaSlicer_Linux_${{ env.ver }}
path: './build/OrcaSlicer_ubu64.AppImage' path: './build/OrcaSlicer_ubu64.AppImage'