Build Firefly Desktop #1
Workflow file for this run
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 Firefly Desktop | |
on: | |
push: | |
tags: | |
- desktop-* | |
workflow_dispatch: | |
inputs: | |
debugElectronBuilder: | |
description: "Verbose electron-builder output" | |
required: true | |
default: "false" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-18.04, macos-latest, windows-latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- name: Set up Python 2.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '2.x' | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- name: Install LLVM and Clang (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 | |
uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd | |
if: matrix.os == 'windows-latest' | |
with: | |
version: "11.0" | |
directory: ${{ runner.temp }}/llvm | |
- name: Set LIBCLANG_PATH (Windows) | |
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | |
if: matrix.os == 'windows-latest' | |
- name: Install required packages (Linux) | |
run: | | |
sudo apt update | |
sudo apt install -y gcc-multilib g++-multilib build-essential libssl-dev rpm libsecret-1-dev \ | |
software-properties-common apt-transport-https libudev-dev libusb-1.0-0-dev \ | |
llvm-dev libclang-dev clang | |
if: matrix.os == 'ubuntu-18.04' | |
- name: Enable verbose output for electron-builder (macOS/Linux) | |
run: echo "DEBUG=electron-builder" >> $GITHUB_ENV | |
if: matrix.os != 'windows-latest' && github.event.inputs.debugElectronBuilder && github.event.inputs.debugElectronBuilder == 'true' | |
- name: Enable verbose output for electron-builder (Windows) | |
run: echo "DEBUG=electron-builder" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
if: matrix.os == 'windows-latest' && github.event.inputs.debugElectronBuilder && github.event.inputs.debugElectronBuilder == 'true' | |
- name: Install dependencies | |
run: yarn | |
- name: Bundle desktop JS | |
run: yarn build | |
working-directory: packages/desktop | |
env: | |
HARDCODE_NODE_ENV: true | |
- name: Build Electron app (macOS) | |
run: yarn compile:mac | |
env: | |
CSC_LINK: ${{ secrets.MAC_CERT_BASE64 }} | |
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERT_PASSWORD }} | |
FIREFLY_APPLE_ID: ${{ secrets.APPLE_ID }} | |
FIREFLY_APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} | |
working-directory: packages/desktop | |
if: matrix.os == 'macos-latest' | |
- name: Build Electron app (Windows) | |
run: yarn compile:win | |
env: | |
CSC_LINK: ${{ secrets.WIN_CERT_BASE64 }} | |
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_PASSWORD }} | |
working-directory: packages/desktop | |
if: matrix.os == 'windows-latest' | |
- name: Build Electron app (Linux) | |
run: yarn compile:linux | |
working-directory: packages/desktop | |
if: matrix.os == 'ubuntu-18.04' | |
- name: Compute checksums (Linux) | |
run: for i in `ls | grep 'firefly-desktop*'` ; do sha256sum $i | awk {'print $1'} > $i.sha256 ; done | |
working-directory: packages/desktop/out | |
if: matrix.os == 'ubuntu-18.04' | |
- name: Compute checksums (macOS) | |
run: for i in `ls | grep 'firefly-desktop*'` ; do shasum -a 256 $i | awk {'print $1'} > $i.sha256 ; done | |
working-directory: packages/desktop/out | |
if: matrix.os == 'macos-latest' | |
- name: Compute checksums (Windows) | |
run: Get-ChildItem "." -Filter firefly-desktop* | Foreach-Object { $(Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash | Set-Content ($_.FullName + '.sha256') } | |
working-directory: packages/desktop/out | |
if: matrix.os == 'windows-latest' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: firefly-desktop-${{ matrix.os }} | |
path: | | |
packages/desktop/out/firefly-desktop* | |
packages/desktop/out/latest* | |
release: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
if: startsWith(github.ref, 'refs/tags/desktop-') | |
steps: | |
- run: echo ${{github.ref}} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Getting version | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/desktop-}" >> $GITHUB_ENV | |
- name: Downloading artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: firefly-desktop-windows-latest | |
path: assets | |
- name: Downloading artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: firefly-desktop-macos-latest | |
path: assets | |
- name: Downloading artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: firefly-desktop-ubuntu-18.04 | |
path: assets | |
- name: Preparing release body | |
run: | | |
sed -i 's/\r$//' ../../assets/*.sha256 && sed -i '/^$/d' ../../assets/*.sha256 && sed -i -e 's/\(.*\)/\L\1/' ../../assets/*.sha256 | |
WIN_SHA256=$(cat ../../assets/firefly-desktop-${{ env.RELEASE_VERSION }}.exe.sha256) | |
LIN_SHA256=$(cat ../../assets/firefly-desktop-${{ env.RELEASE_VERSION }}.AppImage.sha256) | |
MAC_SHA256=$(cat ../../assets/firefly-desktop-${{ env.RELEASE_VERSION }}.dmg.sha256) | |
echo $WIN_SHA256 $LIN_SHA256 $MAC_SHA256 | |
touch CHANGELOG.md | |
echo '### Changelog' >> CHANGELOG.md | |
echo '------' >> CHANGELOG.md | |
echo '### File Hashes' >> CHANGELOG.md | |
echo '| File | Platform | SHA256 Hash |' >> CHANGELOG.md | |
echo '| --- | --- | --- |' >> CHANGELOG.md | |
echo '| firefly-desktop-${{ env.RELEASE_VERSION }}.exe | Windows |' $WIN_SHA256 '|' >> CHANGELOG.md | |
echo '| firefly-desktop-${{ env.RELEASE_VERSION }}.AppImage | Linux |' $LIN_SHA256 '|' >> CHANGELOG.md | |
echo '| firefly-desktop-${{ env.RELEASE_VERSION }}.dmg | MacOS | ' $MAC_SHA256 '|' >> CHANGELOG.md | |
cat CHANGELOG.md | |
working-directory: packages/desktop | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Firefly Desktop ${{ env.RELEASE_VERSION }} | |
body_path: packages/desktop/CHANGELOG.md | |
draft: true | |
prerelease: true | |
- name: Upload macOS binary asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: assets/firefly-desktop-${{ env.RELEASE_VERSION }}.dmg | |
asset_name: firefly-desktop-${{ env.RELEASE_VERSION }}.dmg | |
asset_content_type: application/octet-stream | |
- name: Upload Windows binary asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: assets/firefly-desktop-${{ env.RELEASE_VERSION }}.exe | |
asset_name: firefly-desktop-${{ env.RELEASE_VERSION }}.exe | |
asset_content_type: application/octet-stream | |
- name: Upload Linux binary asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: assets/firefly-desktop-${{ env.RELEASE_VERSION }}.AppImage | |
asset_name: firefly-desktop-${{ env.RELEASE_VERSION }}.AppImage | |
asset_content_type: application/octet-stream | |
# - name: Upload Linux code signature asset | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: assets/firefly-desktop-${{ env.RELEASE_VERSION }}.AppImage.asc | |
# asset_name: firefly-desktop-${{ env.RELEASE_VERSION }}.AppImage.asc | |
# asset_content_type: application/pgp-signature | |
- name: Listing artifacts | |
run: ls -al assets | |
- name: Upload to S3 | |
run: | | |
aws s3 cp assets/ s3://iotaledger-files/4a1ddea1-10c1-4f1d-83f0-e14903931a46/releases/ --recursive --include "*" --exclude "*.sha256" --exclude "*.blockmap" --exclude "*.dmg" --exclude "*.asc" --acl public-read | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-central-1 |