Skip to content

Merge branch 'main' into build #14

Merge branch 'main' into build

Merge branch 'main' into build #14

Workflow file for this run

name: Add PyInstaller assets to latest release
on:
push:
permissions:
contents: write
jobs:
get_tag:
# get the latest tag (separate job as Windows doesn't support this method)
# straightforward because in this repository tags are used only for releases, but we could do a regex match if not
runs-on: ubuntu-latest
outputs:
output: ${{ steps.latest_tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- id: latest_tag
run: |
git fetch -a
echo "tag=$(git tag --sort -committerdate | head -n 1)" >> $GITHUB_OUTPUT
build:
needs: get_tag
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
# install requirements and build
# - note: `certifi` is required here because pyinstaller no longer bundles certificates (pyinstaller #7229)
# - note: `boto3`, `requests`, `google-auth` and corresponding pyinstaller hidden imports are so that advanced
# proxy features work in pre-built pyinstaller binaries
# - note: `--hidden-import timeago.locales.en_short` is required for GUI mode until `timeago` #40 is fixed
- run: |
python -m pip install --upgrade pip
python -m pip install wheel
python -m pip install -r requirements-core.txt -r requirements-gui.txt pyinstaller
python -m pip install certifi
python -m pip install boto3 requests google-auth
python -m PyInstaller --clean --noconsole --onefile --hidden-import timeago.locales.en_short --hidden-import certifi --hidden-import boto3 --hidden-import requests --hidden-import google-auth --icon icon.png emailproxy.py
# add license, documentation, configuration file sample and disclaimer
# - note: `move [...] alias move=mv [...]` is to support using the same commands on all platforms
- run: |
move LICENSE . 2> nul || { shopt -s expand_aliases; alias move=mv; }
move LICENSE dist/
move README.md dist/
move emailproxy.config dist/
echo 'This binary distribution is automatically created for each Email OAuth 2.0 Proxy release, ' >> _.txt
echo 'but is not tested, and is not officially supported. Using the main emailproxy.py script ' >> _.txt
echo 'directly is recommended for best results: https://github.com/simonrob/email-oauth2-proxy/' >> _.txt
move _.txt dist/GettingStarted.txt
# on macOS `--onefile` creates bundle *and* binary; we don't need both (and the .app also contains the binary)
- if: runner.os == 'macOS'
run: rm dist/emailproxy
# zip the built output, naming according to tag and OS
- uses: thedoctor0/[email protected]
with:
type: zip
directory: dist/
filename: emailproxy-${{ needs.get_tag.outputs.output }}_pyinstaller-${{ runner.os }}.zip
# append the zip to the latest release
- uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: dist/*.zip
update_latest_release: true