Executable signing in Github Actions #313
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
# Optionally debug via SSH | |
# Ref: https://fleetdm.com/engineering/tips-for-github-actions-usability | |
# | |
# To use this step uncomment and place anywhere in the build steps. The build will pause on this step and | |
# output a ssh address associated with the Github action worker. Helpful for debugging build steps and | |
# and intermediary files/artifacts. | |
# Example: | |
# Web shell: https://tmate.io/t/q8FU3U9SvmMVxAhMHRyExNhr8 | |
# SSH: ssh [email protected] | |
# | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
name: DRS Downloader | |
on: | |
push: | |
branches: [ "main", "feature/**" ] | |
tags: | |
- '**' | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
# test: | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: ["macos-latest", "ubuntu-latest", "windows-latest"] | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Set up Python | |
# uses: actions/setup-python@v3 | |
# with: | |
# python-version: "3.10" | |
# - name: Install dependencies | |
# shell: bash | |
# run: | | |
# python -m pip install --upgrade pip | |
# pip install flake8 pytest | |
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
# pip install -e . | |
# - name: Lint with flake8 | |
# run: | | |
# # stop the build if there are Python syntax errors or undefined names | |
# flake8 tests/ drs_downloader/ --count --statistics | |
# - name: Unit tests (No server dependencies) with pytest | |
# run: pytest tests/unit --cov=drs_downloader --cov-report term-missing | |
# - name: Unit and Integration tests with pytest | |
# run: pytest tests/unit tests/integration --cov=drs_downloader --cov-report term-missing | |
build: | |
# needs: test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: ["macos-latest", "ubuntu-latest", "windows-latest"] | |
os: ["macos-latest"] | |
steps: | |
- name: Cache executable | |
id: cache-executable | |
uses: actions/cache@v3 | |
with: | |
path: drs-downloader-${{ runner.os }} | |
key: drs-downloader-${{ runner.os }} | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Build executable | |
shell: bash | |
run: | | |
pip install -r requirements.txt -r requirements-dev.txt | |
pyinstaller drs_downloader/cli.py --name drs-downloader-${{ runner.os }} | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
- name: Sign binary | |
uses: lando/code-sign-action@v2 | |
with: | |
file: ./dist/drs_downloader-${{ runner.os }} | |
certificate-data: ${{ secrets.APPLE_CERT_DATA }} | |
certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} | |
apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} | |
apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} | |
apple-team-id: ZA685R3CWP | |
apple-product-id: org.anvilproject.drs_downloader.pkg | |
options: --options runtime --entitlements entitlements.xml | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
# release: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/') | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/download-artifact@v3 | |
# - name: Create checksums | |
# shell: bash | |
# run: | | |
# mkdir release | |
# mv drs-downloader-*/* release | |
# cd release | |
# sha256sum * > checksums.txt | |
# - name: Release | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# files: | | |
# release/* |