Create Executables #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Executables | |
on: | |
workflow_call: | |
inputs: | |
tag: | |
required: true | |
type: string | |
default: ${{ github.ref_name }} | |
description: The tag to use for the release | |
outputs: | |
assets: | |
description: The list of assets | |
value: ${{ jobs.publish-project.outputs.assets }} | |
workflow_run: | |
workflows: ["Draft Release"] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Suffix zip folder' | |
required: false | |
type: string | |
default: 'latest' | |
jobs: | |
setup-environment: | |
name: Setup Environment | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# ensure tags are fetched; https://github.com/adamralph/minver?tab=readme-ov-file#why-is-the-default-version-sometimes-used-in-github-actions-azure-pipelines-and-travis-ci-when-a-version-tag-exists-in-the-history | |
with: | |
fetch-depth: 0 | |
filter: tree:0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
publish-project: | |
runs-on: ${{ matrix.os }} | |
env: | |
tag: ${{ inputs.tag || github.ref_name }} | |
needs: setup-environment | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish | |
run: dotnet publish Resumer/ --output ./publish | |
- name: Zip Files | |
shell: pwsh | |
run: | | |
cd ./publish | |
if ($env:RUNNER_OS -eq "Windows") { | |
mv Resumer.exe resumer.exe | |
7z a ../${{ matrix.os }}_resumer_${{ env.tag }}.zip * | |
} | |
else { | |
mv Resumer resumer | |
zip -1g ../${{ matrix.os }}_resumer_${{ env.tag }}.zip * | |
} | |
cd .. | |
mv publish ${{ matrix.os }}_resumer_${{ env.tag }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}_resumer_${{ env.tag }} | |
path: ${{ matrix.os }}_resumer_${{ env.tag }} | |
- name: Set Output | |
id: set-output | |
run: | | |
echo "assets=${{ matrix.os }}_resumer_${{ env.tag }}" >> $GITHUB_OUTPUT | |
outputs: | |
assets: ${{ steps.set-output.outputs.assets }} |