This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
Add create_release step to Python CI/CD workflow #11
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: Python CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build executable | |
run: python -m PyInstaller --onefile --icon=resources/images/icon.ico --name=SweePy SweePy.py | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: SweePy.exe | |
path: dist/SweePy.exe | |
release: | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: v0.2.15 | |
release_name: Pre-Release v0.2.15 | |
body: | | |
First pre-release of SweePy | |
draft: false | |
prerelease: true | |
- name: Get artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: SweePy.exe | |
path: dist/ | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/SweePy.exe | |
asset_name: SweePy.exe | |
asset_content_type: application/octet-stream |