TokenMap 0.4.0 #10
Workflow file for this run
This file contains hidden or 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: package-linux | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| git_ref: | |
| description: Git ref to build, such as main or v0.1.0 | |
| required: true | |
| default: main | |
| run_tests: | |
| description: Set to false to skip tests for older tags that are packaging-only | |
| required: true | |
| default: true | |
| version: | |
| description: Optional version override for Linux package names | |
| required: false | |
| release_tag: | |
| description: Optional existing release tag to receive the Linux assets | |
| required: false | |
| release: | |
| types: | |
| - published | |
| permissions: | |
| contents: write | |
| jobs: | |
| package-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.git_ref || github.event.release.tag_name }} | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Resolve packaging metadata | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| source ./scripts/packaging-metadata.sh | |
| initialize_packaging_metadata "$PWD" | |
| repo_version="$(get_repo_version)" | |
| if [[ '${{ github.event_name }}' == 'release' ]]; then | |
| git_ref='${{ github.event.release.tag_name }}' | |
| version_input='' | |
| release_tag_input='${{ github.event.release.tag_name }}' | |
| else | |
| git_ref='${{ inputs.git_ref }}' | |
| version_input='${{ inputs.version }}' | |
| release_tag_input='${{ inputs.release_tag }}' | |
| fi | |
| if [[ -n "${version_input}" ]]; then | |
| resolved_version="${version_input}" | |
| elif [[ "${git_ref}" == v* ]]; then | |
| resolved_version="${git_ref#v}" | |
| else | |
| resolved_version="${repo_version}" | |
| fi | |
| if [[ -z "${resolved_version}" ]]; then | |
| echo "Unable to resolve Linux package version." >&2 | |
| exit 1 | |
| fi | |
| { | |
| echo "TOKENMAP_LINUX_VERSION=${resolved_version}" | |
| echo "TOKENMAP_LINUX_RELEASE_TAG=${release_tag_input}" | |
| } >> "${GITHUB_ENV}" | |
| - name: Restore | |
| run: dotnet restore Clever.TokenMap.sln | |
| - name: Build | |
| run: dotnet build Clever.TokenMap.sln --no-restore | |
| - name: Test | |
| if: github.event_name != 'workflow_dispatch' || inputs.run_tests != 'false' | |
| run: dotnet test Clever.TokenMap.sln --no-build | |
| - name: Package Linux artifacts | |
| env: | |
| PACKAGE_VERSION: ${{ env.TOKENMAP_LINUX_VERSION }} | |
| PUBLISH_OUTPUT_ROOT: .artifacts/linux-package-inputs/publish | |
| run: bash ./scripts/package-linux.sh | |
| - name: Resolve Linux artifact paths | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| deb_path="$(find .artifacts/linux-x64 -maxdepth 1 -type f -name '*.deb' | head -n 1)" | |
| portable_path="$(find .artifacts/linux-x64 -maxdepth 1 -type f -name '*.tar.gz' | head -n 1)" | |
| if [[ -z "${deb_path}" || -z "${portable_path}" ]]; then | |
| echo "Expected Linux package artifacts were not found." >&2 | |
| exit 1 | |
| fi | |
| deb_name="$(basename "${deb_path}")" | |
| portable_name="$(basename "${portable_path}")" | |
| artifact_upload_name="${deb_name%.deb}" | |
| { | |
| echo "TOKENMAP_LINUX_DEB_PATH=${deb_path}" | |
| echo "TOKENMAP_LINUX_DEB_NAME=${deb_name}" | |
| echo "TOKENMAP_LINUX_PORTABLE_PATH=${portable_path}" | |
| echo "TOKENMAP_LINUX_PORTABLE_NAME=${portable_name}" | |
| echo "TOKENMAP_LINUX_ARTIFACT_BASE_NAME=${artifact_upload_name}" | |
| } >> "${GITHUB_ENV}" | |
| - name: Upload Linux workflow artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ env.TOKENMAP_LINUX_ARTIFACT_BASE_NAME }} | |
| path: | | |
| ${{ env.TOKENMAP_LINUX_DEB_PATH }} | |
| ${{ env.TOKENMAP_LINUX_PORTABLE_PATH }} | |
| if-no-files-found: error | |
| - name: Attach Linux artifacts to GitHub release | |
| if: env.TOKENMAP_LINUX_RELEASE_TAG != '' | |
| run: | | |
| gh release upload "${{ env.TOKENMAP_LINUX_RELEASE_TAG }}" \ | |
| "${{ env.TOKENMAP_LINUX_DEB_PATH }}" \ | |
| "${{ env.TOKENMAP_LINUX_PORTABLE_PATH }}" \ | |
| --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |