Merge pull request #51 from CSCfi/fix/relative-directory-upload #34
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: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
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@v2 | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
name: Release ${{ github.ref_name }} | |
body: | | |
Release ${{ github.ref_name }} of SDA Uploader GUI (Graphical User Interface). | |
Release ${{ github.ref_name }} of SDA Uploader CLI (Command Line Interface). | |
Linux requires `glibc>=2.17`. | |
Download artifacts in zip archives below. | |
build_gui_release: | |
name: Upload GUI Release Asset | |
needs: create_release | |
strategy: | |
max-parallel: 4 | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
artifact_name: sdagui | |
os_suffix: linux-amd64 | |
asset_name: sdagui | |
- os: windows-latest | |
artifact_name: sdagui.exe | |
os_suffix: windows-amd64 | |
asset_name: sdagui | |
- os: macos-latest | |
artifact_name: sdagui | |
os_suffix: macos-amd64 | |
asset_name: sdagui | |
python-version: ["3.10"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
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 pyinstaller | |
pip install . | |
pip install pyinstaller-versionfile | |
- name: Build GUI artifact macOS | |
if: matrix.os == 'macOS-latest' | |
run: | | |
pyinstaller --noconsole --onefile sdagui.py --name ${{ matrix.asset_name }} | |
- 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 sdagui.py --name ${{ matrix.asset_name }} | |
sudo chown -R $USER:$GROUP dist/ | |
- name: Build GUI artifact windows | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
TAG=${{ github.ref_name }} | |
VERSION=${TAG#v} | |
create-version-file versionfile_gui.yml --outfile file_version_info.txt --version $VERSION | |
pyinstaller --noconsole --onefile sdagui.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 GUI 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@v1 | |
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 | |
build_cli_release: | |
name: Upload CLI Release Asset | |
needs: create_release | |
strategy: | |
max-parallel: 4 | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
artifact_name: sdacli | |
os_suffix: linux-amd64 | |
asset_name: sdacli | |
- os: windows-latest | |
artifact_name: sdacli.exe | |
os_suffix: windows-amd64 | |
asset_name: sdacli | |
- os: macos-latest | |
artifact_name: sdacli | |
os_suffix: macos-amd64 | |
asset_name: sdacli | |
python-version: ["3.10"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
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 pyinstaller | |
pip install . | |
pip install pyinstaller-versionfile | |
- name: Build CLI artifact macOS | |
if: matrix.os == 'macOS-latest' | |
run: | | |
pyinstaller --onefile sdacli.py --name ${{ matrix.asset_name }} | |
- name: Build CLI 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 --onefile sdacli.py --name ${{ matrix.asset_name }} | |
sudo chown -R $USER:$GROUP dist/ | |
- name: Build CLI artifact windows | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
TAG=${{ github.ref_name }} | |
VERSION=${TAG#v} | |
create-version-file versionfile_cli.yml --outfile file_version_info.txt --version $VERSION | |
pyinstaller --onefile sdacli.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 CLI 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@v1 | |
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 |