-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (75 loc) · 3.19 KB
/
release.yml
File metadata and controls
87 lines (75 loc) · 3.19 KB
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
name: Versioned Release
on: [push, pull_request]
jobs:
release:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
arch: [x86_64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup MSYS2
if: matrix.platform == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
install: mingw-w64-x86_64-toolchain make
update: true
- name: Extract intermediate language version number (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
# Get the major and minor versions from the header file
$majorVersion=Get-Content -Path ./src/common_properties.h | Select-String -Pattern '#define IL_MAJOR_VERSION' | ForEach-Object { $_ -split ' ' } | Select-Object -Index 2
$minorVersion=Get-Content -Path ./src/common_properties.h | Select-String -Pattern '#define IL_MINOR_VERSION' | ForEach-Object { $_ -split ' ' } | Select-Object -Index 2
# Set the environment variable
echo "VERSION=$majorVersion.$minorVersion" >> $env:GITHUB_ENV
# Output the version
Write-Host "Version: $majorVersion.$minorVersion"
- name: Extract intermediate language version number (Unix)
id: get_version
if: matrix.platform != 'windows-latest'
shell: bash
run: |
MAJOR_VERSION=$(grep '#define IL_MAJOR_VERSION' ./src/common_properties.h | awk '{print $3}')
MINOR_VERSION=$(grep '#define IL_MINOR_VERSION' ./src/common_properties.h | awk '{print $3}')
echo "VERSION=$MAJOR_VERSION.$MINOR_VERSION" >> $GITHUB_ENV
echo "Version: $MAJOR_VERSION.$MINOR_VERSION"
- name: Build binary
run: make
shell: bash
env:
PLATFORM: ${{ matrix.platform }}
- name: Archive Binary (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
mkdir -p dist
Compress-Archive -Path ./bin/* -DestinationPath "dist/rvm-${{ env.VERSION }}-windows-${{ matrix.arch }}.zip"
- name: Archive Binary (Unix)
if: matrix.platform != 'windows-latest'
shell: bash
run: |
mkdir -p dist
tar -czvf "dist/rvm-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" ./bin/*
- name: Create Git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a v${{ env.VERSION }} -m "Release v${{ env.VERSION }}"
git push origin v${{ env.VERSION }} || true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
files: |
dist/*
body: |
Release v${{ env.VERSION }}
Draft RVM release. May contain bugs and undefined behaviour given the current state of the project.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}