Skip to content

Commit c56e257

Browse files
committed
Release: Automatically create Github release
1 parent ab40205 commit c56e257

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

.github/workflows/release.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'AutoRelease'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_suffix:
7+
description: Suffix of the version number. Can be used to create a preview package.
8+
required: false
9+
type: string
10+
11+
env:
12+
configuration: Release
13+
version_suffix: ${{ github.event.inputs.version_suffix }}
14+
15+
jobs:
16+
build_linux:
17+
name: Build (Linux)
18+
runs-on: ubuntu-latest
19+
container:
20+
image: fedora:latest
21+
env:
22+
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
23+
24+
defaults:
25+
run:
26+
shell: bash
27+
28+
steps:
29+
- name: Install dependencies
30+
run: sudo dnf -y upgrade && sudo dnf -y install meson gobject-introspection-devel git gcc glib2-devel gdk-pixbuf2 gdk-pixbuf2-modules cairo-gobject
31+
32+
- name: Prepare git
33+
run: git config --global core.autocrlf false
34+
shell: bash
35+
36+
- name: Checkout with submodules
37+
uses: actions/checkout@v4
38+
with:
39+
submodules: 'true'
40+
41+
- name: Create Gir.Core
42+
uses: ./.github/actions/create
43+
with:
44+
configuration: ${{ env.configuration }}
45+
source_directory: './src'
46+
script_directory: './scripts'
47+
shell: bash
48+
49+
- name: Pack release version
50+
run: dotnet pack --no-build --nologo -c $configuration --version-suffix "$version_suffix" -o ../Nuget
51+
working-directory: './src'
52+
53+
- name: "Create GitHub release"
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
prerelease_flag=""
58+
if [ -n "$version_suffix" ]; then
59+
prerelease_flag="--prerelease"
60+
fi
61+
version = dotnet fsi ./scripts/GetVersion.fsx "$version_suffix"
62+
gh release create "$version" --draft --generate-notes --title "$version" $prerelease_flag ../Nuget/*

scripts/GetVersion.fsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#r "nuget: FSharp.Data, 6.4.1"
2-
32
open FSharp.Data
43

4+
let versionSuffix = match fsi.CommandLineArgs.Length with
5+
| n when n > 1 -> "-" + fsi.CommandLineArgs.[1]
6+
| _ -> ""
7+
58
type publishingProperties = XmlProvider<"../properties/GirCore.Publishing.props">
69

710
let versionPrefix = publishingProperties.GetSample().PropertyGroups
@@ -10,5 +13,5 @@ let versionPrefix = publishingProperties.GetSample().PropertyGroups
1013
|Some vp -> vp.VersionPrefix.Value
1114
|None -> "Versionprefix not found"
1215

13-
System.Console.WriteLine(versionPrefix)
16+
System.Console.WriteLine(versionPrefix+versionSuffix)
1417

src/GirCore.sln

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
100100
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
101101
..\.github\workflows\codeql-analysis.yml = ..\.github\workflows\codeql-analysis.yml
102102
..\.github\workflows\update-gir-files.yml = ..\.github\workflows\update-gir-files.yml
103+
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
103104
EndProjectSection
104105
EndProject
105106
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Generation", "Generation", "{5D5D80C1-4D21-4619-8B59-7B7750016E9D}"

0 commit comments

Comments
 (0)