-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
443 additions
and
197 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
output: ${{ steps.latest_tag.outputs.tag }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- id: latest_tag | ||
run: | | ||
git fetch -a | ||
|
@@ -31,44 +31,44 @@ jobs: | |
os: [macos-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11.2' | ||
python-version: '3.x' | ||
|
||
# install requirements and build | ||
# - note: `--hidden-import` is required for GUI mode until https://github.com/hustcc/timeago/issues/40 is fixed | ||
- run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install wheel | ||
python -m pip install -r requirements.txt pyinstaller | ||
python -m pip install -r requirements-core.txt -r requirements-gui.txt pyinstaller | ||
python -m PyInstaller --clean --noconsole --onefile --hidden-import timeago.locales.en_short --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 . 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].1 | ||
- uses: thedoctor0/[email protected].6 | ||
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 | ||
- uses: xresloader/upload-to-github-release@v1.3.12 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Deploy to PyPI and add to latest release | ||
|
||
on: | ||
push: | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
# see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
# set up build environment and package the proxy | ||
- run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install build | ||
python -m build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-pypi: | ||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/emailproxy | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
# upload the built packages to PyPI (we use a token rather than trusted publishing due to our unconventional build branch method) | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI }} | ||
skip-existing: true # avoid failing when repeating this action | ||
|
||
# sign the built packages | ||
- uses: sigstore/[email protected] | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
# append the built packages to the latest release | ||
- uses: xresloader/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
file: dist/*.whl;dist/*.tar.gz | ||
update_latest_release: true |
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
Oops, something went wrong.