Skip to content

Build

Build #29

Workflow file for this run

name: Build
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade -r requirements.txt
pip install --upgrade pyinstaller
- name: Build target
working-directory: ${{ github.workspace }}
run: pyinstaller --onefile --version-file version.rc --paths valve_keyvalues_python nt_hammer_bootstrap.py
- name: Copy other requirements
working-directory: ${{ github.workspace }}
shell: powershell
run: |
Copy-Item "LICENSE" -Destination ".\dist"
Copy-Item "README.md" -Destination ".\dist"
- name: Create build compressed archive
working-directory: ${{ github.workspace }}
shell: powershell
run: Compress-Archive -Path ./dist -DestinationPath ${{ github.workspace }}/${{ github.event.repository.name }}-${{ runner.os }}.zip
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}+${{ runner.os }}
release_name: Release ${{ github.ref }} (${{runner.os}})
body: Automated release build for ${{ runner.os }}. This is a standalone build that bundles all the requirements into the executable.
draft: true
prerelease: true
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ github.workspace }}/${{ github.event.repository.name }}-${{ runner.os }}.zip
asset_name: ${{ github.event.repository.name }}-${{ runner.os }}.zip
asset_content_type: application/zip