From 795277b997c544c5874ac66c70d00af741270a6c Mon Sep 17 00:00:00 2001 From: Daniel Collingwood <82693586+danzuep@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:14:51 +0800 Subject: [PATCH] GitVersion, Android --- .github/workflows/_publish.yml | 24 +++++++-------- .github/workflows/_version.yml | 53 +++++++++++++++++----------------- .github/workflows/release.yml | 2 +- README.md | 2 +- 4 files changed, 39 insertions(+), 42 deletions(-) diff --git a/.github/workflows/_publish.yml b/.github/workflows/_publish.yml index 0da843a..1513df1 100644 --- a/.github/workflows/_publish.yml +++ b/.github/workflows/_publish.yml @@ -1,5 +1,5 @@ -name: 🚀 Deploy to NuGet -run-name: Deploy ${{ inputs.projectName }} NuGet package +name: 🚀 Publish Android package +run-name: Publish ${{ inputs.projectName }} Android package on: workflow_call: @@ -24,17 +24,11 @@ on: description: 'The publish configuration' default: Release type: string - secrets: - envPAT: - required: true jobs: deploy: - name: 🚀 ${{ inputs.projectName }} + name: Android runs-on: ubuntu-latest - permissions: - contents: read - packages: write environment: ${{ inputs.environment }} steps: @@ -44,10 +38,7 @@ jobs: # https://github.com/actions/setup-dotnet - name: Get .NET externals - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.x - dotnet-quality: 'ga' + uses: actions/setup-dotnet@v4 # https://github.com/actions/cache/blob/main/examples.md#c---nuget - name: Get any cached NuGet packages from the last run @@ -58,7 +49,12 @@ jobs: restore-keys: nugetpackages-${{ runner.os }} - name: Publish Android package - run: dotnet publish $projectFile -c $configuration -f $targetFramework /p:Version=$buildVersion /p:AndroidPackageFormats=$androidPackageFormats -o $publishOutputFolder --nologo; + run: | + echo "Project Name: $projectName"; + echo "Project File: $projectFile"; + echo "Project Version: $buildVersion"; + dotnet workload restore; + dotnet publish $projectFile -c $configuration -f $targetFramework /p:Version=$buildVersion /p:AndroidPackageFormats=$androidPackageFormats -o $publishOutputFolder --nologo; env: projectFile: '${{ inputs.projectFile }}' buildVersion: '${{ inputs.version }}' diff --git a/.github/workflows/_version.yml b/.github/workflows/_version.yml index 189e674..bf5b735 100644 --- a/.github/workflows/_version.yml +++ b/.github/workflows/_version.yml @@ -16,7 +16,7 @@ on: jobs: version: - name: Version + name: GitVersion runs-on: 'ubuntu-latest' outputs: # alternative usage: $GitVersion_ @@ -26,8 +26,8 @@ jobs: majorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }} preReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }} commitDate: ${{ steps.gitversion.outputs.commitDate }} - projectName: $projectName - projectFile: $projectFile + projectName: ${{ steps.metadata.outputs.projectName }} + projectFile: ${{ steps.metadata.outputs.projectFile }} steps: # https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches @@ -37,15 +37,20 @@ jobs: fetch-depth: 0 - name: Get Git repository project name and list all project files in the directory + id: metadata shell: bash run: | - echo "projectName=$(basename '${{ github.repository }}')" >> $GITHUB_ENV - echo "Project name: $projectName" + repositoryName=$(basename '${{ github.repository }}') + echo "Project name: $repositoryName" shopt -s globstar for project in ./**/*.csproj; do echo "Project file: $project" - echo "projectFile=$project" >> $GITHUB_ENV + projectFile=${project} done + echo "projectName=${repositoryName}" >> $GITHUB_ENV + echo "projectName=${repositoryName}" >> $GITHUB_OUTPUT + echo "projectFile=${projectFile}" >> $GITHUB_ENV + echo "projectFile=${projectFile}" >> $GITHUB_OUTPUT - run: | echo "Generate release notes from the Git commit log." @@ -78,33 +83,29 @@ jobs: uses: gittools/actions/gitversion/execute@v0 - run: | - echo 'Save the GitVersion outputs to a file.' - echo "Major: ${{ steps.gitversion.outputs.major }}" > version.txt - echo "Minor: ${{ steps.gitversion.outputs.minor }}" >> version.txt - echo "Patch: ${{ steps.gitversion.outputs.patch }}" >> version.txt - echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" >> version.txt - echo 'Semantic Version: ${{ steps.gitversion.outputs.semVer }}' >> version.txt - echo 'Full Semantic Version: ${{ steps.gitversion.outputs.fullSemVer }}' >> version.txt - echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}" >> version.txt - echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}" >> version.txt - echo 'CommitDate: ${{ steps.gitversion.outputs.commitDate }}' >> version.txt - - # https://github.com/actions/upload-artifact - - name: Upload version artifacts - uses: actions/upload-artifact@v3 - with: - path: | - version.txt - release-notes.txt + echo 'Save the GitVersion environment variables to a file.' + echo "projectName=${projectName}" > version.txt + echo "projectFile=${projectFile}" >> version.txt + for var in $(env | grep '^GitVersion_' | cut -d= -f1); do + echo "$var=${!var}" >> version.txt + done # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary - name: Markdown workflow job summary run: | - echo '### ${{ env.workflowName }} build summary' >> $GITHUB_STEP_SUMMARY + echo '### ${{ env.workflowVersion }} build summary' >> $GITHUB_STEP_SUMMARY echo "Repository: ${{ github.repository }}" >> $GITHUB_STEP_SUMMARY echo "Branch: ${{ github.ref }}" >> $GITHUB_STEP_SUMMARY echo 'Commit Date: ${{ steps.gitversion.outputs.commitDate }}' >> $GITHUB_STEP_SUMMARY echo 'Full Semantic Version: ${{ steps.gitversion.outputs.fullSemVer }}' >> $GITHUB_STEP_SUMMARY echo 'Pre-release Label: ${{ steps.gitversion.outputs.preReleaseLabel }}' >> $GITHUB_STEP_SUMMARY env: - workflowName: '$projectName version ${{ steps.gitversion.outputs.semVer }}' + workflowVersion: '${{ steps.metadata.outputs.projectName }} version ${{ steps.gitversion.outputs.semVer }}' + + # https://github.com/actions/upload-artifact + - name: Upload version artifacts + uses: actions/upload-artifact@v3 + with: + path: | + version.txt + release-notes.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 766dd49..48b1030 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,6 @@ jobs: uses: ./.github/workflows/_publish.yml with: projectName: ${{ needs.version.outputs.projectName }} - projectFile: ${{ needs.version.outputs.projectFiles }} + projectFile: ${{ needs.version.outputs.projectFile }} version: ${{ needs.version.outputs.semVer }} secrets: inherit diff --git a/README.md b/README.md index e307a26..a66dd31 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LocalGuideAI -Local Guide app using ChatGPT AI, a project for Microsoft Hack Together: The Great .NET 8 Hack. +A local guide in the form of an app that uses ChatGPT AI. A project for Microsoft Hack Together: The Great .NET 8 Hack. ![PC](https://raw.githubusercontent.com/danzuep/LocalGuideAI/main/Assets/Animations/PC.gif)