Update build.yml #2
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: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' # Trigger the workflow when a new tag is pushed. | |
workflow_dispatch: # Allow manual workflow runs. | |
inputs: | |
tagName: | |
description: 'Tag Name to Release' # This will show in the GitHub UI | |
required: true | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.tagName }} # Check out the tag provided in manual trigger | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pandas scipy matplotlib numpy pyinstaller | |
- name: Build Executable with PyInstaller | |
run: pyinstaller --onefile --windowed ORCASpectrumPlot.py | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.checkout.outputs.tag_name || github.event.inputs.tagName }} | |
release_name: Release ${{ steps.checkout.outputs.tag_name || github.event.inputs.tagName }} | |
draft: false | |
prerelease: false | |
- name: Upload Executable Artifact to Release | |
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/ORCASpectrumPlot.exe | |
asset_name: ORCASpectrumPlot.exe | |
asset_content_type: application/octet-stream |