diff --git a/.github/workflows/build-datebadge-task.yml b/.github/workflows/build-datebadge-task.yml index 08eaed35..8f7f8f8d 100644 --- a/.github/workflows/build-datebadge-task.yml +++ b/.github/workflows/build-datebadge-task.yml @@ -1,8 +1,5 @@ name: Build BYOB date badge task -env: - IS_MAIN_BRANCH: ${{ endsWith(github.ref, 'refs/heads/main') }} - on: workflow_call: @@ -20,7 +17,7 @@ jobs: echo "date=$(date)" >> $GITHUB_OUTPUT - name: Build BYOB date badge step - if: ${{ env.IS_MAIN_BRANCH == 'true' }} + if: ${{ github.ref_name == 'main' }} uses: RubbaBoy/BYOB@v1 with: name: lastbuild diff --git a/.github/workflows/build-docker-task.yml b/.github/workflows/build-docker-task.yml index 3e61c540..6e2284cc 100644 --- a/.github/workflows/build-docker-task.yml +++ b/.github/workflows/build-docker-task.yml @@ -1,11 +1,5 @@ name: Build Docker image task -env: - IS_MAIN_BRANCH: ${{ endsWith(github.ref, 'refs/heads/main') }} - DOCKER_REGISTRY: docker.io - DOCKER_TAG_PREFIX: docker.io/ptr727/projecttemplate - DOCKER_FILE: ./Docker/Dockerfile - on: workflow_call: inputs: @@ -45,7 +39,6 @@ jobs: - name: Login to Docker Hub step uses: docker/login-action@v3 with: - registry: ${{ env.DOCKER_REGISTRY }} username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} @@ -54,16 +47,16 @@ jobs: with: context: . push: ${{ inputs.push }} - file: ${{ env.DOCKER_FILE }} + file: ./Docker/Dockerfile tags: | - ${{ env.DOCKER_TAG_PREFIX }}:${{ env.IS_MAIN_BRANCH == 'true' && 'latest' || 'develop' }} - ${{ env.DOCKER_TAG_PREFIX }}:${{ needs.get-version.outputs.SemVer2 }} + docker.io/ptr727/projecttemplate:${{ github.ref_name == 'main' && 'latest' || 'develop' }} + docker.io/ptr727/projecttemplate:${{ needs.get-version.outputs.SemVer2 }} platforms: linux/amd64,linux/arm64 - cache-from: type=registry,ref=${{ env.DOCKER_TAG_PREFIX }}:buildcache - cache-to: type=registry,ref=${{ env.DOCKER_TAG_PREFIX }}:buildcache,mode=max + cache-from: type=registry,ref=docker.io/ptr727/projecttemplate:buildcache + cache-to: type=registry,ref=docker.io/ptr727/projecttemplate:buildcache,mode=max build-args: | LABEL_VERSION=${{ needs.get-version.outputs.SemVer2 }} - BUILD_CONFIGURATION=${{ env.IS_MAIN_BRANCH == 'true' && 'Release' || 'Debug' }} + BUILD_CONFIGURATION=${{ github.ref_name == 'main' && 'Release' || 'Debug' }} BUILD_VERSION=${{ needs.get-version.outputs.AssemblyVersion }} BUILD_FILE_VERSION=${{ needs.get-version.outputs.AssemblyFileVersion }} BUILD_ASSEMBLY_VERSION=${{ needs.get-version.outputs.AssemblyFileVersion }} diff --git a/.github/workflows/build-executable-task.yml b/.github/workflows/build-executable-task.yml index 749f83cf..f205969c 100644 --- a/.github/workflows/build-executable-task.yml +++ b/.github/workflows/build-executable-task.yml @@ -1,10 +1,5 @@ name: Build executable task -env: - IS_MAIN_BRANCH: ${{ endsWith(github.ref, 'refs/heads/main') }} - PROJECT_FILE: ./Console/Console.csproj - PROJECT_ARTIFACT: Console.7z - on: workflow_call: outputs: @@ -38,16 +33,16 @@ jobs: uses: actions/checkout@v6 - name: Build executable project step - run: >- - dotnet publish ${{ env.PROJECT_FILE }} - --runtime ${{ matrix.runtime }} - --output ${{ runner.temp }}/publish/${{ matrix.runtime }} - --configuration ${{ env.IS_MAIN_BRANCH == 'true' && 'Release' || 'Debug' }} - -property:PublishAot=false - -property:Version=${{ needs.get-version.outputs.AssemblyVersion }} - -property:FileVersion=${{ needs.get-version.outputs.AssemblyFileVersion }} - -property:AssemblyVersion=${{ needs.get-version.outputs.AssemblyVersion }} - -property:InformationalVersion=${{ needs.get-version.outputs.AssemblyInformationalVersion }} + run: | + dotnet publish ./Console/Console.csproj \ + --runtime ${{ matrix.runtime }} \ + --output ${{ runner.temp }}/publish/${{ matrix.runtime }} \ + --configuration ${{ github.ref_name == 'main' && 'Release' || 'Debug' }} \ + -property:PublishAot=false \ + -property:Version=${{ needs.get-version.outputs.AssemblyVersion }} \ + -property:FileVersion=${{ needs.get-version.outputs.AssemblyFileVersion }} \ + -property:AssemblyVersion=${{ needs.get-version.outputs.AssemblyVersion }} \ + -property:InformationalVersion=${{ needs.get-version.outputs.AssemblyInformationalVersion }} \ -property:PackageVersion=${{ needs.get-version.outputs.SemVer2 }} - name: Upload matrix build artifacts step @@ -73,11 +68,11 @@ jobs: path: ${{ runner.temp }}/publish - name: Zip build output step - run: 7z a -t7z ${{ runner.temp }}/${{ env.PROJECT_ARTIFACT }} ${{ runner.temp }}/publish/* + run: 7z a -t7z ${{ runner.temp }}/Console.7z ${{ runner.temp }}/publish/* - name: Upload build artifacts step id: artifact-upload-step uses: actions/upload-artifact@v6 with: name: executable-build - path: ${{ runner.temp }}/${{ env.PROJECT_ARTIFACT }} + path: ${{ runner.temp }}/Console.7z diff --git a/.github/workflows/build-library-task.yml b/.github/workflows/build-library-task.yml index 59078238..57565ab0 100644 --- a/.github/workflows/build-library-task.yml +++ b/.github/workflows/build-library-task.yml @@ -1,10 +1,5 @@ name: Build library task -env: - IS_MAIN_BRANCH: ${{ endsWith(github.ref, 'refs/heads/main') }} - PROJECT_FILE: ./Library/Library.csproj - PROJECT_ARTIFACT: Library.7z - on: workflow_call: inputs: @@ -43,31 +38,31 @@ jobs: uses: actions/checkout@v6 - name: Build library project step - run: >- - dotnet build ${{ env.PROJECT_FILE }} - --output ${{ runner.temp }}/publish - --configuration ${{ env.IS_MAIN_BRANCH == 'true' && 'Release' || 'Debug' }} - -property:Version=${{ needs.get-version.outputs.AssemblyVersion }} - -property:FileVersion=${{ needs.get-version.outputs.AssemblyFileVersion }} - -property:AssemblyVersion=${{ needs.get-version.outputs.AssemblyVersion }} - -property:InformationalVersion=${{ needs.get-version.outputs.AssemblyInformationalVersion }} - -property:PackageVersion=${{ needs.get-version.outputs.SemVer2 }} + run: | + dotnet build ./Library/Library.csproj \ + --output ${{ runner.temp }}/publish \ + --configuration ${{ github.ref_name == 'main' && 'Release' || 'Debug' }} \ + -property:Version=${{ needs.get-version.outputs.AssemblyVersion }} \ + -property:FileVersion=${{ needs.get-version.outputs.AssemblyFileVersion }} \ + -property:AssemblyVersion=${{ needs.get-version.outputs.AssemblyVersion }} \ + -property:InformationalVersion=${{ needs.get-version.outputs.AssemblyInformationalVersion }} \ + -property:PackageVersion=${{ needs.get-version.outputs.SemVer2 }} - name: Publish to NuGet.org step if: ${{ inputs.push }} - run: >- - dotnet nuget push ${{ runner.temp }}/publish/*.nupkg - --source https://api.nuget.org/v3/index.json - --api-key ${{ secrets.NUGET_API_KEY }} + run: | + dotnet nuget push ${{ runner.temp }}/publish/*.nupkg \ + --source https://api.nuget.org/v3/index.json \ + --api-key ${{ secrets.NUGET_API_KEY }} \ --skip-duplicate - name: Zip output step run: | - 7z a -t7z ${{ runner.temp }}/${{ env.PROJECT_ARTIFACT }} ${{ runner.temp }}/publish/* + 7z a -t7z ${{ runner.temp }}/Library.7z ${{ runner.temp }}/publish/* - name: Upload build artifacts step id: artifact-upload-step uses: actions/upload-artifact@v6 with: name: library-build - path: ${{ runner.temp }}/${{ env.PROJECT_ARTIFACT }} + path: ${{ runner.temp }}/Library.7z diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index 077346c0..20130c2c 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -1,8 +1,5 @@ name: Build project release task -env: - IS_MAIN_BRANCH: ${{ endsWith(github.ref, 'refs/heads/main') }} - on: workflow_call: inputs: @@ -78,7 +75,7 @@ jobs: with: generate_release_notes: true tag_name: ${{ needs.get-version.outputs.SemVer2 }} - prerelease: ${{ env.IS_MAIN_BRANCH != 'true' }} + prerelease: ${{ github.ref_name != 'main' }} files: | LICENSE README.md diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 05f4fa22..8bbf5e06 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -2,7 +2,7 @@ name: Test pull request action on: pull_request: - branches: [ main, develop ] + branches: [ main, develop, codegen ] workflow_dispatch: concurrency: