This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
Merge pull request #3 from maksii/uploaderrmerge #5
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 | |
paths-ignore: | |
- '.github/**' | |
- '.*' | |
- 'README.md' | |
jobs: | |
build: | |
runs-on: windows-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: Prepare files for zip | |
run: | | |
mkdir zip_content | |
mkdir zip_content/data | |
Copy-Item -Path dist/upload.exe -Destination zip_content/ | |
Copy-Item -Path data/config.example.json -Destination zip_content/data/config.json | |
Copy-Item -Path data/naming.json -Destination zip_content/data/ | |
Copy-Item -Path data/tags.json -Destination zip_content/data/ | |
- name: Create zip file | |
run: | | |
Compress-Archive -Path zip_content/* -DestinationPath utopia_ua.zip | |
- name: Archive executable | |
uses: actions/upload-artifact@v3 | |
with: | |
name: upload-executable | |
path: utopia_ua.zip | |
- name: Create Tag | |
id: create_tag | |
shell: pwsh | |
run: | | |
$TAG_NAME = "v$(Get-Date -Format 'yyyyMMddHHmmss')" | |
echo "TAG_NAME=$TAG_NAME" >> $env: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.REPO_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.GITHUB_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 |