Skip to content

print: default output based on parent process name #470

print: default output based on parent process name

print: default output based on parent process name #470

Workflow file for this run

name: publish
on:
push:
paths:
- "src/**"
- ".github/workflows/publish.yml"
branches:
- main
pull_request:
paths:
- "src/**"
- ".github/workflows/publish.yml"
workflow_dispatch:
inputs:
release_tag:
required: true
description: "Tag for the new release"
prerelease:
description: "If true, the release will be set as a prerelease and not impact the latest tag"
type: boolean
required: true
default: false
jobs:
create_release:
if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/main' || github.event.inputs.prerelease == 'true')
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create.outputs.release_id }}
steps:
- name: Create release
id: create
env:
RELEASE_TAG: ${{ github.event.inputs.release_tag }}
PRERELEASE: ${{ github.event.inputs.prerelease }}
GH_TOKEN: ${{ github.token }}
shell: pwsh
run: |
if ($env:PRERELEASE -eq 'true') {
$releaseUrl = gh release create "$env:RELEASE_TAG" --repo Brightspace/bmx --draft --prerelease --generate-notes --title "Release $env:RELEASE_TAG"
} else {
$releaseUrl = gh release create "$env:RELEASE_TAG" --repo Brightspace/bmx --draft --generate-notes --title "Release $env:RELEASE_TAG"
}
if ( $LASTEXITCODE -ne 0 ) { throw "Failed to create draft release" }
$releaseId = $releaseUrl -split '/' | Select-Object -Last 1
"release_id=$releaseId" >> $env:GITHUB_OUTPUT
build:
needs: create_release
if: ${{ !failure() }}
strategy:
matrix:
include:
- machine: windows-latest
platform: win
file_name: bmx.exe
- machine: macos-latest
platform: osx
file_name: bmx
runs-on: ${{ matrix.machine }}
timeout-minutes: 10
env:
PLATFORM: ${{ matrix.platform }}
steps:
- name: checkout
uses: Brightspace/third-party-actions@actions/checkout
- name: set up .NET
uses: Brightspace/third-party-actions@actions/setup-dotnet
with:
dotnet-version: 8.0.x
- name: publish
shell: pwsh
working-directory: src/D2L.Bmx
run: |
dotnet publish -r $env:PLATFORM-x64 -o build
- name: upload build
if: github.event_name == 'workflow_dispatch'
shell: pwsh
env:
RELEASE_TAG: ${{ needs.create_release.outputs.release_id }}
PLATFORM: ${{ matrix.platform }}
FILE_NAME: ${{ matrix.file_name }}
GH_TOKEN: ${{ github.token }}
working-directory: src/D2L.Bmx/build
run: |
if ($env:PLATFORM -eq 'win') {
Compress-Archive -Path "bmx.exe" -DestinationPath "bmx-win.zip"
gh release upload "$env:RELEASE_TAG" "bmx-win.zip"
} elseif ($env:PLATFORM -eq 'osx') {
chmod +x "bmx"
tar -czvf "bmx-osx.tar.gz" "bmx"
gh release upload "$env:RELEASE_TAG" "bmx-osx.tar.gz"
}
build_docker:
needs: create_release
if: ${{ !failure() }}
strategy:
matrix:
include:
- file: Dockerfile.ubuntu
platform: linux
- file: Dockerfile.alpine
platform: linux.alpine
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: checkout
uses: Brightspace/third-party-actions@actions/checkout
- name: setup docker buildx
uses: docker/setup-buildx-action@v2
- name: publish
shell: pwsh
env:
DOCKERFILE: ${{ matrix.file }}
run: |
docker buildx build -f $env:DOCKERFILE -o build .
- name: upload build
if: github.event_name == 'workflow_dispatch'
shell: bash
env:
RELEASE_TAG: ${{ needs.create_release.outputs.release_id }}
PLATFORM: ${{ matrix.platform }}
GH_TOKEN: ${{ github.token }}
working-directory: build
run: |
chmod +x "bmx"
tar -czvf "bmx-$PLATFORM.tar.gz" "bmx"
gh release upload "$RELEASE_TAG" "bmx-$PLATFORM.tar.gz"
publish_release:
needs: [create_release, build, build_docker]
runs-on: ubuntu-latest
timeout-minutes: 5
env:
RELEASE_TAG: ${{ needs.create_release.outputs.release_id }}
GH_TOKEN: ${{ github.token }}
steps:
- name: finalize release
run: |
gh release edit "$RELEASE_TAG" --draft=false --repo Brightspace/bmx