release #85
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: [workflow_dispatch] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
concurrency: release | |
environment: | |
name: pypi | |
url: https://pypi.org/p/codelimit | |
permissions: | |
id-token: write | |
contents: write | |
outputs: | |
version: ${{ steps.release.outputs.version }} | |
steps: | |
- name: 'Checkout sources' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 'Set up Python' | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: 'Set up Poetry' | |
uses: snok/install-poetry@v1 | |
- name: 'Install dependencies' | |
run: poetry install --no-interaction --no-root | |
- name: 'Python Semantic Release' | |
id: release | |
uses: relekang/python-semantic-release@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Update checkout' | |
run: | | |
git pull | |
if: steps.release.outputs.released == 'true' | |
- name: 'Build distribution' | |
run: poetry build | |
- name: 'Publish to PyPI' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: steps.release.outputs.released == 'true' | |
- name: 'Update files' | |
uses: MathieuSoysal/[email protected] | |
with: | |
files: README.md | |
prefix: 'rev: ' | |
with-checkout: false | |
version: ${{ steps.release.outputs.version }} | |
- name: 'Commit GitHub Action distribution' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m 'Update files' || true | |
- name: 'Push changes' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force: true | |
release_binaries: | |
name: 'Release binaries' | |
needs: release | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
TARGET: macos | |
CMD_BUILD: | | |
poetry run pyinstaller \ | |
-n codelimit -F codelimit/__main__.py | |
mv dist/codelimit dist/codelimit-macos | |
OUT_FILE_NAME: dist/codelimit-macos | |
- os: windows-latest | |
TARGET: windows | |
CMD_BUILD: | | |
poetry run pyinstaller \ | |
-n codelimit --onefile -c codelimit/__main__.py | |
OUT_FILE_NAME: dist/codelimit.exe | |
- os: ubuntu-latest | |
TARGET: linux | |
CMD_BUILD: | | |
poetry run pyinstaller \ | |
-n codelimit -F codelimit/__main__.py | |
mv dist/codelimit dist/codelimit-linux | |
OUT_FILE_NAME: dist/codelimit-linux | |
steps: | |
- name: 'Checkout sources' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: 'Set up Python' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: 'Install Poetry' | |
uses: snok/install-poetry@v1 | |
- name: 'Install dependencies' | |
run: poetry install --no-interaction --no-root | |
- name: 'Build codelimit with pyinstaller for ${{matrix.TARGET}}' | |
run: ${{matrix.CMD_BUILD}} | |
- name: 'Release' | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ format('v{0}', needs.release.outputs.version) }} | |
files: | | |
${{ matrix.OUT_FILE_NAME }} |