This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
Build #351
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: Build | |
on: | |
workflow_run: | |
workflows: ["Run Tests"] | |
branches: [main] | |
types: | |
- completed | |
env: | |
APP_NAME: icy_term | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install gtk | |
run: | | |
sudo apt-get update | |
sudo apt-get install build-essential libgtk-3-dev libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev | |
- name: Install cargo deb & get | |
run: | | |
cargo install cargo-deb | |
cargo install cargo-get | |
- name: Build deb | |
id: build-deb | |
run: | | |
export VERSION="$(cargo get package.version)" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
export DEB=$(cargo deb) | |
echo "Copy $DEB to ${{ env.APP_NAME }}_${VERSION}_amd64.deb" | |
mv $DEB ${{ env.APP_NAME }}_${VERSION}_amd64.deb | |
sed "s/#VERSION/$VERSION/g" <build/file_id.diz >file_id.diz | |
- name: 'Upload deb' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_NAME }}_linux_${{ env.VERSION }} | |
path: | | |
${{ env.APP_NAME }}_${{ env.VERSION }}_amd64.deb | |
file_id.diz | |
build_windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build exe | |
run: | | |
cargo build --release | |
- name: Install WiX | |
run: dotnet tool install --global wix --version 4.0.1 | |
- name: Create PFX certificate | |
id: create-pfx | |
shell: pwsh | |
env: | |
PFX_CONTENT: ${{ secrets.WINDOWS_CERTIFICATE_BASE64 }} | |
run: | | |
$encodedBytes=[System.Convert]::FromBase64String($env:PFX_CONTENT); | |
Set-Content "./cert.pfx" -Value $encodedBytes | |
$VERSION=$(cargo pkgid | foreach-object { $_ -replace '(.*)#','' }) | |
echo "Version: $VERSION" | |
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$VERSION" | |
get-content .\build\file_id.diz | %{$_ -replace "#VERSION","$VERSION"} >file_id.diz | |
- name: Build MSI installer. | |
run: | | |
echo "Building ${{ env.VERSION }} installer…" | |
wix extension add WixToolset.UI.wixext WixToolset.Util.wixext | |
wix build -arch "x64" -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -d "PATH=./cert.pfx" -d "VERSION=${{ env.VERSION }}" -out "./${{ env.APP_NAME }}-${{ env.VERSION }}-installer.msi" "build/windows/installer.wxs" | |
- name: Delete PFX certificate | |
run: del "./cert.pfx" | |
- name: 'Upload installer' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_NAME }}_${{ env.VERSION }}_windows_msi | |
path: | | |
${{ env.APP_NAME }}-${{ env.VERSION }}-installer.msi | |
file_id.diz | |
- name: Copy exe | |
run: cp ".\target\release\${{ env.APP_NAME }}.exe" . | |
- name: 'Upload plain exe' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_NAME }}_${{ env.VERSION }}_windows_exe | |
path: | | |
.\${{ env.APP_NAME }}.exe | |
file_id.diz | |
### 32 bit | |
build_windows_32bit: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build exe | |
run: | | |
rustup install i686-pc-windows-gnu | |
rustup default i686-pc-windows-gnu | |
cargo build --release | |
- name: Install WiX | |
run: dotnet tool install --global wix --version 4.0.1 | |
- name: Create PFX certificate | |
id: create-pfx | |
shell: pwsh | |
env: | |
PFX_CONTENT: ${{ secrets.WINDOWS_CERTIFICATE_BASE64 }} | |
run: | | |
$encodedBytes=[System.Convert]::FromBase64String($env:PFX_CONTENT); | |
Set-Content "./cert.pfx" -Value $encodedBytes | |
$VERSION=$(cargo pkgid | foreach-object { $_ -replace '(.*)#','' }) | |
echo "Version: $VERSION" | |
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$VERSION" | |
get-content .\build\file_id.diz | %{$_ -replace "#VERSION","$VERSION"} >file_id.diz | |
- name: Build MSI installer. | |
run: | | |
echo "Building ${{ env.VERSION }} installer…" | |
wix extension add WixToolset.UI.wixext WixToolset.Util.wixext | |
wix build -arch "x64" -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -d "PATH=./cert.pfx" -d "VERSION=${{ env.VERSION }}" -out "./${{ env.APP_NAME }}-${{ env.VERSION }}-installer.msi" "build/windows/installer.wxs" | |
- name: Delete PFX certificate | |
run: del "./cert.pfx" | |
- name: 'Upload installer' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_NAME }}_${{ env.VERSION }}_32bit_windows_msi | |
path: | | |
${{ env.APP_NAME }}-${{ env.VERSION }}-installer.msi | |
file_id.diz | |
- name: Copy exe | |
run: cp ".\target\release\${{ env.APP_NAME }}.exe" . | |
- name: 'Upload plain exe' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_NAME }}_${{ env.VERSION }}_32bit_windows_exe | |
path: | | |
.\${{ env.APP_NAME }}.exe | |
file_id.diz | |
### | |
build_mac: | |
strategy: | |
matrix: | |
target: [aarch64-apple-darwin, x86_64-apple-darwin] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cargo bundle & get | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo install cargo-bundle | |
cargo install cargo-get | |
brew install create-dmg | |
- name: Build dmg | |
run: | | |
cargo bundle --release --target ${{ matrix.target }} | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.OSX_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.OSX_CERTIFICATE_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.OSX_CERTIFICATE_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
- name: Sign dmg | |
id: sign-bundle | |
run: | | |
export version="$(cargo get package.version)" | |
echo "VERSION=$version" >> $GITHUB_ENV | |
sed "s/#VERSION/$version/g" <build/file_id.diz >file_id.diz | |
export MAC_APP=$(cat Cargo.toml | grep "name" | awk -F"\"" '{print $2}' | head -n 2 | tail -n 1) | |
codesign --force --deep --verbose --sign "mkrueger@posteo.de" "target/${{ matrix.target }}/release/bundle/osx/${MAC_APP}.app/" | |
create-dmg \ | |
--volname "${MAC_APP} Installer" \ | |
--volicon "target/${{ matrix.target }}/release/bundle/osx/${MAC_APP}.app/Contents/Resources/${MAC_APP}.icns" \ | |
--window-pos 200 120 \ | |
--window-size 800 400 \ | |
--icon-size 100 \ | |
--hide-extension "${MAC_APP}.app" \ | |
--app-drop-link 600 185 \ | |
"${{ env.APP_NAME }}-$version-${{ matrix.target }}.dmg" \ | |
"target/${{ matrix.target }}/release/bundle/osx/${MAC_APP}.app/" | |
- name: Clean up keychain and provisioning profile | |
run: | | |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db | |
# rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision | |
- name: 'Upload dmg' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_NAME }}_osx_${{ env.VERSION }}_${{ matrix.target }} | |
path: | | |
${{ env.APP_NAME }}-${{ env.VERSION }}-${{ matrix.target }}.dmg | |
file_id.diz |