Skip to content

change macos arch name to arm as it is no longer amd in the latest im… #51

change macos arch name to arm as it is no longer amd in the latest im…

change macos arch name to arm as it is no longer amd in the latest im… #51

Workflow file for this run

name: Release
on:
push:
tags:
- "*.*.*"
permissions:
contents: write
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
id: ${{ steps.create_release.outputs.id }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v4
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
Release ${{ steps.vars.outputs.tag }} of crypt4gh GUI (Graphical User Interface).
build_release:
name: Upload Release Asset
needs: create_release
strategy:
max-parallel: 4
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
artifact_name: crypt4gh-gui
os_suffix: linux-amd64
asset_name: crypt4gh-gui
- os: windows-latest
artifact_name: crypt4gh-gui.exe
os_suffix: windows-amd64
asset_name: crypt4gh-gui
- os: macos-latest
artifact_name: crypt4gh-gui
os_suffix: macos-arm64
asset_name: crypt4gh-gui
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install python3-dev -y
- name: Install Windows dependencies
if: matrix.os == 'windows-latest'
run: |
choco install zip
- name: Install macOS dependencies
if: matrix.os == 'macOS-latest'
run: |
brew install coreutils
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install pyinstaller-versionfile
- name: Build GUI artifact Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
docker pull cscfi/pyinstaller
docker run --rm -v "${PWD}:/builder" cscfi/pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
sudo chown -R $USER:$GROUP dist/
- name: Build GUI artifact macOS
if: matrix.os == 'macOS-latest'
run: |
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
- name: Build GUI artifact windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
TAG=${{ github.ref_name }}
VERSION=${TAG/.0*./.${TAG:6:1}.} # remove leading zero for windows version
create-version-file versionfile.yml --outfile file_version_info.txt --version $VERSION
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }} --version-file file_version_info.txt
- name: Create temporary certificate file
if: matrix.os == 'windows-latest'
run: |
cd ${{ github.workspace }}
echo "${{ secrets.CERTIFICATE_BASE64 }}" >> certificate.b64
certutil -decode certificate.b64 certificate.crt
del certificate.b64
- name: Sign windows executable
if: matrix.os == 'windows-latest'
shell: cmd
env:
PASSWORD_ENV: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |
cd ${{ github.workspace }}
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe" sign /f .\certificate.crt /p %PASSWORD_ENV% /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 .\dist\${{ matrix.artifact_name }}
del certificate.crt
- name: Build Asset
run: |
cd ./dist
zip --junk-paths ${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip ${{ matrix.artifact_name }}
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./dist/${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip
fail_on_unmatched_files: true