This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
Update main.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 # This triggers the workflow on pushes to the main branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' # Always use the latest stable version of Python 3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
pip install -r requirements.txt | |
- name: Install PyInstaller | |
run: pip install pyinstaller | |
- name: Build executable | |
run: pyinstaller upload.spec | |
- name: Archive executable | |
run: zip -r utopia_ua.zip dist/ | |
# Adjust the path to your executable if necessary | |
- name: Create Tag | |
id: create_tag | |
run: | | |
TAG_NAME=v$(date +'%Y%m%d%H%M%S') | |
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV | |
git tag $TAG_NAME | |
git push origin $TAG_NAME | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
release_name: Release ${{ env.TAG_NAME }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./utopia_ua.zip | |
asset_name: utopia_ua.zip | |
asset_content_type: application/zip |