Skip to content

Commit

Permalink
feat: publish binary once pr has been merged
Browse files Browse the repository at this point in the history
  • Loading branch information
valter-silva-au committed Jan 13, 2023
1 parent ef6337c commit 45fa76b
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,84 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: python
package-name: aws-auto-inventory

build:
runs-on: ${{ matrix.os }}
if: ${{ steps.release.outputs.release_created }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9]
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# - name: Test with pytest
# run: |
# pytest

- name: Build binary for ${{ matrix.os }}
run: pyinstaller --name aws-auto-inventory-${{ matrix.os }} --clean --onefile --hidden-import cmath --log-level=DEBUG app/cli.py

- uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-latest' && steps.release.outputs.release_created }}
with:
name: aws-auto-inventory-${{ matrix.os }}
path: dist\aws-auto-inventory-windows-latest.exe

- uses: actions/upload-artifact@v3
if: ${{ matrix.os != 'windows-latest' && steps.release.outputs.release_created }}
with:
name: aws-auto-inventory-${{ matrix.os }}
path: ./dist/aws-auto-inventory-${{ matrix.os }}

release:
needs: build
runs-on: ubuntu-latest
if: ${{ steps.release.outputs.release_created }}
steps:
- uses: actions/download-artifact@v3
with:
name: aws-auto-inventory-ubuntu-latest
- uses: actions/download-artifact@v3
with:
name: aws-auto-inventory-macos-latest
- uses: actions/download-artifact@v3
with:
name: aws-auto-inventory-windows-latest
- run: mv aws-auto-inventory-ubuntu-latest aws-auto-inventory-ubuntu
- run: mv aws-auto-inventory-macos-latest aws-auto-inventory-macos
- run: mv aws-auto-inventory-windows-latest.exe aws-auto-inventory-windows.exe
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
draft: true
files: |
aws-auto-inventory-ubuntu
aws-auto-inventory-macos
aws-auto-inventory-windows.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 45fa76b

Please sign in to comment.