Workflow updates #23
Workflow file for this run
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 Publish Self-Contained Assemblies | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to build and release' | |
required: true | |
default: 'main' | |
release_version: | |
description: 'Release version (e.g., v1.0.0)' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: | |
- linux-x64 | |
- linux-arm64 | |
- osx-x64 | |
- osx-arm64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Set up .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '6.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build self-contained assembly | |
run: | | |
dotnet publish -c Release -r ${{ matrix.runtime }} --self-contained -p:PublishSingleFile=true -o ./publish/${{ matrix.runtime }} | |
mv ./publish/${{ matrix.runtime }}/EmpireCompiler ./EmpireCompiler | |
shell: bash | |
- name: Git Archive All | |
run: | | |
python scripts/git_archive_all.py \ | |
--include "EmpireCompiler" \ | |
publish/EmpireCompiler-${{ matrix.runtime }}-${{ github.event.inputs.release_version }}.tgz | |
shell: bash | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: EmpireCompiler-${{ matrix.runtime }} | |
path: ./publish/EmpireCompiler-${{ matrix.runtime }}-${{ github.event.inputs.release_version }}.tgz | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./publish | |
merge-multiple: true | |
- name: Create Git tag | |
run: | | |
git tag ${{ github.event.inputs.release_version }} | |
git push origin ${{ github.event.inputs.release_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release assets | |
if: github.event_name == 'workflow_dispatch' | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ./publish/* | |
tag_name: ${{ github.event.inputs.release_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |