Fixed Auto-Build #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 # or the branch you want to trigger the workflow on | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Chocolatey | |
run: | | |
Set-ExecutionPolicy Bypass -Scope Process -Force | |
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
- name: Install MinGW and GCC | |
run: | | |
choco install mingw -y | |
- name: Build executable | |
run: | | |
g++ -o YTCompression.exe src/YTCompression.cpp | |
- name: Get version number | |
id: get_version | |
run: | | |
$VERSION = Get-Content src/version.txt | |
Write-Output "VERSION=$VERSION" | Out-File -Append -FilePath $env:GITHUB_ENV | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: ${{ env.VERSION }} | |
body: 'Release of version ${{ env.VERSION }}' | |
- 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: ./YTCompression.exe | |
asset_name: YTCompression.exe | |
asset_content_type: application/octet-stream |