Skip to content

Release v0.1.6-alpha #13

Release v0.1.6-alpha

Release v0.1.6-alpha #13

Workflow file for this run

# This workflow will publish the project
name: Publish
on:
workflow_dispatch:
inputs:
config-file:
type: string
default: "./publish/config.json"
target-os:
type: choice
default: all
options:
- windows
- linux
- macos
- all
target-runtime:
type: choice
default: all
options:
- x86
- x64
- arm
- arm64
- all
release:
types: [published]
env:
dotnet-version: 8.x
default-config-file: "./publish/config.json"
default-target-os: all
default-target-runtime: all
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.publish-config-parser.outputs.profiles }}
status: ${{ steps.checker.outputs.status }}
project-file: ${{ steps.publish-config-parser.outputs.project-file }}
output-name: ${{ steps.publish-config-parser.outputs.output-name }}
target-os: ${{ steps.inputs.outputs.target-os }}
target-runtime: ${{ steps.inputs.outputs.target-runtime }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
submodules: recursive
- id: inputs
shell: bash
run: |
config_file='${{ github.event.inputs.config-file }}'
target_os='${{ github.event.inputs.target-os }}'
target_runtime='${{ github.event.inputs.target-runtime }}'
echo "config-file=${config_file:=${{ env.default-config-file }}}" >> $GITHUB_OUTPUT
echo "target-os=${target_os:=${{ env.default-target-os }}}" >> $GITHUB_OUTPUT
echo "target-runtime=${target_runtime:=${{ env.default-target-runtime }}}" >> $GITHUB_OUTPUT
- name: Parse configuration "${{ github.event.inputs.config-file }}"
id: publish-config-parser
uses: ./.github/actions/publish-config-parser
with:
config-file: ${{ env.config-file }}
tags: "${{ env.target-os }},${{ env.target-runtime }}"
env:
config-file: ${{ steps.inputs.outputs.config-file }}
target-os: ${{ steps.inputs.outputs.target-os }}
target-runtime: ${{ steps.inputs.outputs.target-runtime }}
- name: Check profiles
id: checker
run: |
profiles='${{ steps.publish-config-parser.outputs.profiles }}'
length=$( echo $profiles | jq '.include | length' )
if(( $length > 0 )); then
echo "status=success" >> $GITHUB_OUTPUT
else
echo "status=failure" >> $GITHUB_OUTPUT
echo "No suitable publish profile found"
fi
publish:
name: Publish
needs: prepare
if: needs.prepare.outputs.status == 'success'
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.prepare.outputs.matrix)}}
outputs:
version-full: "${{ steps.version-number.outputs.suffix-githash-version }}"
version-short: "${{ steps.version-number.outputs.suffix-version }}"
env:
output-name: ${{ needs.prepare.outputs.output-name }}
project-file: ${{ needs.prepare.outputs.project-file }}
configuration: ${{ matrix.configuration }}
framework: ${{ matrix.framework }}
runtime: ${{ matrix.runtime }}
publish-options: ${{ matrix.options }}
output-path: '.publish/output/bin/${{ matrix.configuration }}/${{ matrix.framework }}/${{ matrix.runtime }}'
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
submodules: recursive
- name: Install .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: ${{ env.dotnet-version }}
- id: version-number
uses: finebits/github-actions/version-number@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
- uses: finebits/github-actions/pre-build/replace@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
with:
file: ./src/Eppie.CLI/Eppie.CLI/Options/AuthorizationOptions.cs
placeholder: '\"<Gmail-ClientId>\"'
value: "${{ secrets.GMAIL_CLIENT_ID }}"
- uses: finebits/github-actions/pre-build/replace@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
with:
file: ./src/Eppie.CLI/Eppie.CLI/Options/AuthorizationOptions.cs
placeholder: '\"<Gmail-ClientSecret>\"'
value: "${{ secrets.GMAIL_CLIENT_SECRET }}"
- uses: finebits/github-actions/pre-build/replace@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
with:
file: ./src/Eppie.CLI/Eppie.CLI/Options/AuthorizationOptions.cs
placeholder: '\"<Outlook-ClientId>\"'
value: "${{ secrets.OUTLOOK_CLIENT_ID }}"
- name: Publish ${{ env.output-name }} [${{ env.version-short }}]
run: |
dotnet publish "${{ env.project-file }}" --output "${{ env.output-path }}" --configuration "${{ env.configuration }}" --framework "${{ env.framework }}" --runtime "${{ env.runtime }}" --property:Version="${{ env.version-full }}" ${{ env.publish-options }}
env:
version-full: "${{ steps.version-number.outputs.suffix-githash-version }}"
version-short: "${{ steps.version-number.outputs.suffix-version }}"
- name: Check AZURE secrets
if: ${{ matrix.os == 'windows-latest' }}
id: check-azure-secrets
shell: bash
run: |
exist=true
if [ "${{ secrets.AZURE_TENANT_ID }}" == "" ]; then
echo "::warning::'secrets.AZURE_TENANT_ID' is empty"
exist=false
fi
if [ "${{ secrets.AZURE_CLIENT_ID }}" == "" ]; then
echo "::warning::'secrets.AZURE_CLIENT_ID' is empty"
exist=false
fi
if [ "${{ secrets.AZURE_CLIENT_SECRET }}" == "" ]; then
echo "::warning::'secrets.AZURE_CLIENT_SECRET' is empty"
exist=false
fi
if [ "${{ secrets.TRUSTED_SIGNING_ACCOUNT_NAME }}" == "" ]; then
echo "::warning::'secrets.TRUSTED_SIGNING_ACCOUNT_NAME' is empty"
exist=false
fi
if [ "${{ secrets.CERTIFICATE_PROFILE_NAME }}" == "" ]; then
echo "::warning::'secrets.CERTIFICATE_PROFILE_NAME' is empty"
exist=false
fi
echo "exist=$exist" >> GITHUB_OUTPUT
- name: Sign files with Trusted Signing
if: ${{ matrix.os == 'windows-latest' && env.apply == 'true' }}
uses: azure/trusted-signing-action@1d39813ad911e92e52c3e8f2c5abc0fbf70f973e # v0.3.20
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://neu.codesigning.azure.net/
trusted-signing-account-name: ${{ secrets.TRUSTED_SIGNING_ACCOUNT_NAME }}
certificate-profile-name: ${{ secrets.CERTIFICATE_PROFILE_NAME }}
files-folder: ${{ env.output-path }}
files-folder-filter: exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
env:
apply: ${{ steps.check-azure-secrets.outputs.exist }}
- name: Upload artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: "${{ env.artifact-name }}-${{ env.runtime }} [${{ env.version-short }}]"
path: "${{ env.output-path }}"
env:
artifact-name: "${{ env.output-name }}"
version-short: "${{ steps.version-number.outputs.suffix-version }}"
appimage-package:
name: Pack AppImage
needs: [ prepare, publish ]
runs-on: ubuntu-latest
if: ${{ needs.prepare.outputs.target-os == 'all' || needs.prepare.outputs.target-os == 'linux' }}
strategy:
matrix:
include:
- target-runtime: 'x64'
artifact_pattern: '*linux-x64*'
appimage-arch: x86_64
- target-runtime: 'arm64'
artifact_pattern: '*linux-arm64*'
appimage-arch: aarch64
- target-runtime: 'arm'
artifact_pattern: '*linux-arm*'
appimage-arch: armhf
env:
artifacts-root: './.artifacts'
output-path: './.publish/output/packages'
package-app-dir: './packages/appimage-package/AppDir'
prepare-script: './packages/appimage-package/prepare-AppDir.sh'
steps:
- name: Check runtime
run: |
go_on=${{ needs.prepare.outputs.target-runtime == 'all' || needs.prepare.outputs.target-runtime == matrix.target-runtime }}
echo "GITHUB_ACTION_GO_PACK=$go_on" >> $GITHUB_ENV
- name: Checkout
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
submodules: recursive
- name: Setup appimagetool
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
uses: finebits/github-actions/package/appimage/setup-appimagetool@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
- name: Download ${{ matrix.artifact_pattern }} Artifacts
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
path: "${{ env.artifacts-root }}"
pattern: "${{ matrix.artifact_pattern }}"
- name: Prepare Package
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
shell: bash
run: |
item=$(find "${{ env.artifacts-root }}" -name "${{ matrix.artifact_pattern }}" | head -n 1)
if [ ! -d "$item" ] ; then
echo "::error::Artifact '${{ matrix.artifact_pattern }}' not found."
exit 1
fi
echo "$(bash "${{ env.prepare-script }}" "$item")"
mkdir -p "${{ env.output-path }}"
- name: Pack appimagetool
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
uses: finebits/github-actions/package/appimage/pack@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
with:
package-runtime: ${{ matrix.appimage-arch }}
package-app-dir: "${{ env.package-app-dir }}"
package-output-dir: "${{ env.output-path }}"
- name: Read name
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
id: package-name
shell: bash
run: |
item=$(find "${{ env.output-path }}" -name "*.AppImage" | head -n 1)
if [ ! -f "$item" ] ; then
echo "::error::AppImage Pacakge '$item' not found."
exit 1
fi
item_name="${item##*/}"
echo "name=$item_name" >> $GITHUB_OUTPUT
- name: Upload artifacts
if: ${{ env.GITHUB_ACTION_GO_PACK == 'true' }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: "${{ env.artifact-name }} [${{ env.version-short }}]"
path: "${{ env.output-path }}"
env:
artifact-name: "${{ steps.package-name.outputs.name }}"
version-short: "${{ needs.publish.outputs.version-short }}"
upload-assets:
name: Upload Assets
if: github.event_name == 'release'
needs: [ publish, appimage-package ]
runs-on: ubuntu-latest
permissions:
contents: write
env:
artifacts-root: './.artifacts'
assets-root: './.assets'
steps:
- name: Download All Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
path: "${{ env.artifacts-root }}"
- name: Prepare Assets
shell: bash
run: |
asset_root="${{ env.assets-root }}"
mkdir -p "${asset_root}"
artifact_pattern="${{ env.artifacts-root }}/*"
for item in $artifact_pattern ; do
if [ -d "$item" ] ; then
item_name="${item##*/}"
# remove version
asset_name="${item_name% [*}"
if [[ "$asset_name" == *"-osx-"* || "$asset_name" == *"-linux-"* ]]; then
tar -czf "$asset_root/${asset_name}.tar.gz" -C "$item" . && echo "Archiving of the asset '$asset_name' has been completed successfully." || echo "::warning::Failed to archive asset '$asset_name'"
elif [[ "$asset_name" == *"-win-"* ]]; then
zip -rjq "$asset_root/${asset_name}.zip" "$item" && echo "Archiving of the asset '$asset_name' has been completed successfully." || echo "::warning::Failed to archive asset '$asset_name'"
elif [[ "$asset_name" == *".AppImage" ]]; then
file=$(find "$item" -name "*.AppImage" | head -n 1)
echo "package: ${file}"
cp "${file}" "$asset_root" && echo "Copying of the asset '$asset_name' has been completed successfully." || echo "::warning::Failed to copy asset '$asset_name'"
else
echo "::warning::Unknown asset type: '$asset_name'"
fi
fi
done
- name: Upload All Assets
uses: finebits/github-actions/upload-release-asset@5424db33bef4ae0d027325c568a0a36094bc229e # v1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.release.tag_name }}
path: "${{ env.assets-root }}/*"