Skip to content

Add initial release github action #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: CI
name: Pre-release main branch

on:
push:
branches:
- main
tags:
- "*.*.*"

permissions:
contents: read
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Pre-release main branch

on:
release:
types: [published]

permissions:
contents: read
packages: write

jobs:
containers:
runs-on: ubuntu-latest
outputs:
full-version: ${{ steps.bootstrap.outputs.full-version }}
major-version: ${{ steps.bootstrap.outputs.major-version }}

steps:
- uses: actions/checkout@v4

- name: Bootstrap Action Workspace
id: bootstrap
uses: ./.github/actions/bootstrap

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Publish Containers
run: ./build.sh publishcontainers

release:
needs: [containers]
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
outputs:
full-version: ${{ steps.bootstrap.outputs.full-version }}
major-version: ${{ steps.bootstrap.outputs.major-version }}

steps:
- uses: actions/checkout@v4

- name: Bootstrap Action Workspace
id: bootstrap
uses: ./.github/actions/bootstrap

- name: Publish Binaries
run: ./build.sh publishzip

- name: Attach Distribution to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.ref_name }} .artifacts/publish/docs-builder/release/*.zip
25 changes: 21 additions & 4 deletions build/BuildInformation.fs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ module BuildInformation

open System
open System.IO
open System.Runtime.InteropServices
open System.Threading
open System.Xml.Linq
open System.Xml.XPath
@@ -63,8 +64,24 @@ type OS =
| OSX | Windows | Linux
with
static member Current =
match int Environment.OSVersion.Platform with
| 4 | 128 -> Linux
| 6 -> OSX
| _ -> Windows
match 1 with
| _ when RuntimeInformation.IsOSPlatform OSPlatform.OSX -> OSX
| _ when RuntimeInformation.IsOSPlatform OSPlatform.Windows -> Windows
| _ -> Linux

static member Name =
match OS.Current with
| Linux -> "linux"
| OSX -> "mac"
| Windows -> "win"

static member Arch =
match RuntimeInformation.ProcessArchitecture with
| Architecture.X86 -> "x86"
| Architecture.X64 -> "x64"
| Architecture.Arm -> "arm"
| Architecture.Arm64 -> "arm64"
| _ -> "unknown"



2 changes: 2 additions & 0 deletions build/CommandLine.fs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ type Build =
| [<CliPrefix(CliPrefix.None);SubCommand>] Publish
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] PublishBinaries
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] PublishContainers
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] PublishZip

| [<CliPrefix(CliPrefix.None);SubCommand>] ReleaseNotes
| [<CliPrefix(CliPrefix.None);SubCommand>] Release
@@ -51,6 +52,7 @@ with
| PristineCheck
| PublishBinaries
| PublishContainers
| PublishZip
| ValidateLicenses
| ReleaseNotes
| Compile
17 changes: 17 additions & 0 deletions build/Targets.fs
Original file line number Diff line number Diff line change
@@ -57,6 +57,22 @@ let private pristineCheck (arguments:ParseResults<Build>) =
let private publishBinaries _ =
exec { run "dotnet" "publish" "src/docs-builder/docs-builder.csproj" }
exec { run "dotnet" "publish" "src/docs-generator/docs-generator.csproj" }
Zip.zip
".artifacts/publish/docs-builder/release"
$"docs-builder-%s{OS.Name}-{OS.Arch}.zip"
[".artifacts/publish/docs-builder/release/docs-builder"]

let private publishZip _ =
exec { run "dotnet" "publish" "src/docs-builder/docs-builder.csproj" }
let binary = match OS.Current with Windows -> "docs-builder.exe" | _ -> "docs-builder"
Zip.zip
".artifacts/publish/docs-builder/release"
$".artifacts/publish/docs-builder/release/docs-builder-%s{OS.Name}-{OS.Arch}.zip"
[
$".artifacts/publish/docs-builder/release/%s{binary}";
".artifacts/publish/docs-builder/release/LICENSE.txt";
".artifacts/publish/docs-builder/release/NOTICE.txt"
]

let private publishContainers _ =

@@ -155,6 +171,7 @@ let Setup (parsed:ParseResults<Build>) =
| PristineCheck -> Build.Step pristineCheck
| PublishBinaries -> Build.Step publishBinaries
| PublishContainers -> Build.Step publishContainers
| PublishZip -> Build.Step publishZip
| ValidateLicenses -> Build.Step validateLicenses
| ReleaseNotes -> Build.Step generateReleaseNotes

1 change: 1 addition & 0 deletions build/build.fsproj
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
<PackageReference Include="Octokit" Version="13.0.1" />
<PackageReference Include="Proc.Fs" Version="0.9.1" />
<PackageReference Include="Fake.Tools.Git" Version="6.1.3" />
<PackageReference Include="Fake.IO.Zip" Version="6.1.3" />
<PackageReference Remove="FSharp.Core"/>
<PackageReference Include="FSharp.Core" Version="9.0.100" />
</ItemGroup>