-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (93 loc) · 3.05 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-15]
steps:
- name: Set runtime env var
run: |
case ${{ matrix.os }} in
ubuntu-24.04)
echo "runtime=linux-x64" >> $GITHUB_ENV
;;
ubuntu-24.04-arm)
echo "runtime=linux-arm64" >> $GITHUB_ENV
;;
macos-13)
echo "runtime=osx-x64" >> $GITHUB_ENV
;;
macos-15)
echo "runtime=osx-arm64" >> $GITHUB_ENV
;;
esac
- 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 ${{ env.runtime }} --self-contained -p:PublishSingleFile=true -o ./publish/${{ env.runtime }}
mv ./publish/${{ env.runtime }}/EmpireCompiler ./EmpireCompiler/EmpireCompiler
shell: bash
- name: Git Archive All
run: |
python scripts/git_archive_all.py \
--include "EmpireCompiler/EmpireCompiler" \
publish/EmpireCompiler-${{ env.runtime }}-${{ github.event.inputs.release_version }}.tgz
shell: bash
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: EmpireCompiler-${{ env.runtime }}
path: ./publish/EmpireCompiler-${{ env.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 }}