Skip to content

Build and Release

Build and Release #20

name: Build and Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libncurses5-dev
pip install -r requirements.txt
- name: Get latest release tag
id: get_latest_tag
run: |
latest_tag=$(git tag -l | sort -V | tail -n 1)
echo "::set-output name=tag::${latest_tag:-v1.0.2}"
continue-on-error: true
- name: Increment version
id: increment_version
run: |
current_tag=${{ steps.get_latest_tag.outputs.tag }}
version_parts=(${current_tag//./ })
new_version="${version_parts[0]}.${version_parts[1]}.$((version_parts[2]+1))"
echo "::set-output name=next_version::${new_version}"
- name: Build executable
run: |
pyinstaller --onefile main.py
mv ./dist/main ./dist/CWA_Linux
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.increment_version.outputs.next_version }}
allowUpdates: "true"
release_name: Release ${{ steps.increment_version.outputs.next_version }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/main
asset_name: Console-Weather-App
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Cleanup
run: rm -r build