Skip to content

Bump the test-dependencies group with 2 updates #672

Bump the test-dependencies group with 2 updates

Bump the test-dependencies group with 2 updates #672

name: Continuous Delivery
on:
push: {}
pull_request: {}
workflow_dispatch:
inputs:
force-release:
type: boolean
description: Force tag & release even when the source branch is not main or no production source files have changed
jobs:
check-release-requirement:
runs-on: ubuntu-latest
outputs:
needs-release: ${{ steps.release-check.outputs.needs-release }}
semantic-version: ${{ steps.get-semver.outputs.semantic-version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: GetSemVer
id: get-semver
run: |
dotnet tool install --global GitVersion.Tool --version 6.0.4
output=$(dotnet-gitversion)
semver=$(echo $output | grep -oP '"SemVer"\s*:\s*"\K[^"]+')
echo $output
echo "Semantic version: $semver"
echo "semantic-version=$semver" >> $GITHUB_OUTPUT
- name: Check for Release Requirement
id: release-check
run: |
productionFilesChangedCount=$(git diff --name-only HEAD^ HEAD | grep -E 'src/|Installer/' | wc -l)
echo "$productionFilesChangedCount production source code files have changed"
productionFilesChanged=$((productionFilesChangedCount > 0))
echo "Git ref: ${{ github.ref_name }}"
branchIsMain=$([[ "${{ github.ref_name }}" == "main" ]] && echo true || echo false)
forceReleaseRequested=$([[ "${{ github.event.inputs.force-release }}" == "true" ]] && echo true || echo false)
echo "Forced release requested: $forceReleaseRequested"
needsRelease=$([[ "$forceReleaseRequested" == "true" || ( "$productionFilesChanged" == "1" && "$branchIsMain" == "true" ) ]] && echo true || echo false)
echo "Release will be generated: $needsRelease"
echo "needs-release=$needsRelease" >> $GITHUB_OUTPUT
display-job-outputs:
needs: check-release-requirement
runs-on: ubuntu-latest
steps:
- name: Display Job Outputs
run: |
echo "needs-release = ${{ needs.check-release-requirement.outputs.needs-release }}"
echo "semantic-version = ${{ needs.check-release-requirement.outputs.semantic-version }}"
build-windows:
runs-on: windows-latest
needs: check-release-requirement
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build & Test
run: ./Build/build-and-test.ps1
shell: pwsh
- name: Upload Coverage Badge
if: github.event_name != 'pull_request' && github.actor != 'dependabot[bot]'
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.CODE_COVERAGE_AUTH_TOKEN }}
gist_id: 527882e89a938dc78f61a08c300edec4
gist_description: "code-coverage-${{ github.ref_name }}"
gist_file_name: fmsync-code-coverage-${{ github.ref_name }}.svg
file_path: tests/TestResults/badge_shieldsio_linecoverage_green.svg
- name: Run codacy-coverage-reporter
if: github.actor != 'dependabot[bot]'
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: tests/TestResults/Cobertura.xml
- name: Build Windows Installer
run: ./Build/build-windows-installer.ps1
shell: pwsh
- name: Upload Windows Artifact
if: needs.check-release-requirement.outputs.needs-release == 'true'
uses: actions/upload-artifact@v3
with:
name: windows-installer
path: ./Installer/Elzik.FmSync.WindowsInstaller/bin/x64/Release/en-US/fmsync*.msi
build-macos:
runs-on: macos-latest
needs: check-release-requirement
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build & Test
run: ./Build/build-and-test.ps1
shell: pwsh
- name: Build OSX Installer
run: ./Build/build-osx-installer.ps1
shell: pwsh
- name: Upload macOS Artifact
if: needs.check-release-requirement.outputs.needs-release == 'true'
uses: actions/upload-artifact@v3
with:
name: macos-installer
path: ./Installer/Elzik.FmSync.OsxInstaller/x64/Release/fmsync-osx*.zip
release:
runs-on: ubuntu-latest
needs: [build-windows, build-macos, check-release-requirement]
if: needs.check-release-requirement.outputs.needs-release == 'true'
steps:
- uses: actions/checkout@v4
- name: Tag With SemVer
run: |
git tag "v${{ needs.check-release-requirement.outputs.semantic-version }}"
git push --tags
- uses: actions/download-artifact@v3
with:
name: windows-installer
path: ./windows-installer
- uses: actions/download-artifact@v3
with:
name: macos-installer
path: ./macos-installer
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.check-release-requirement.outputs.semantic-version }}
generate_release_notes: true
prerelease: ${{ github.ref_name != 'main' }}
files: |
./windows-installer/fmsync*.msi
./macos-installer/fmsync-osx*.zip