-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35f7879
commit 595fe4a
Showing
1 changed file
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ jobs: | |
Build: | ||
runs-on: ubuntu-latest | ||
env: | ||
buildConfiguration: 'Release' | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
IMAGE_NAME: 'azure-devops-cleaner' | ||
DOCKER_BUILDKIT: 1 # Enable Docker BuildKit | ||
|
@@ -34,12 +33,13 @@ jobs: | |
fetch-depth: 0 # Required for GitVersion | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/setup@v0.10 | ||
uses: gittools/actions/gitversion/setup@v0 | ||
with: | ||
versionSpec: '5.x' | ||
|
||
- name: Determine Version | ||
uses: gittools/actions/gitversion/[email protected] | ||
uses: gittools/actions/gitversion/execute@v0 | ||
id: gitversion | ||
with: | ||
useConfigFile: true | ||
|
||
|
@@ -49,14 +49,14 @@ jobs: | |
dotnet-version: 8.x | ||
|
||
- name: Test | ||
run: dotnet test -c $buildConfiguration --verbosity normal --collect "Code coverage" | ||
run: dotnet test -c Release --collect "Code coverage" | ||
|
||
- name: Publish | ||
run: | | ||
dotnet publish \ | ||
$GITHUB_WORKSPACE/Tingle.AzdoCleaner/Tingle.AzdoCleaner.csproj \ | ||
-c $buildConfiguration \ | ||
-o $GITHUB_WORKSPACE/drop/Tingle.AzdoCleaner | ||
${{ github.workspace }}/Tingle.AzdoCleaner/Tingle.AzdoCleaner.csproj \ | ||
-c Release \ | ||
-o ${{ github.workspace }}/drop/Tingle.AzdoCleaner | ||
- name: Replace tokens | ||
uses: cschleiden/replace-tokens@v1 | ||
|
@@ -68,27 +68,27 @@ jobs: | |
with: | ||
azcliversion: 2.45.0 # somehow 2.46.0 is failing | ||
inlineScript: | | ||
cp $GITHUB_WORKSPACE/main.bicep $GITHUB_WORKSPACE/drop/main.bicep | ||
az bicep build --file main.bicep --outfile $GITHUB_WORKSPACE/drop/main.json | ||
cp ${{ github.workspace }}/main.bicep ${{ github.workspace }}/drop/main.bicep | ||
az bicep build --file main.bicep --outfile ${{ github.workspace }}/drop/main.json | ||
- name: Pull Docker base image & warm Docker cache | ||
run: docker pull "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest" | ||
run: docker pull "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest" | ||
|
||
- name: Build image | ||
run: | | ||
docker build \ | ||
-f Tingle.AzdoCleaner/Dockerfile \ | ||
--label com.github.image.run.id=$GITHUB_RUN_ID \ | ||
--label com.github.image.run.number=$GITHUB_RUN_NUMBER \ | ||
--label com.github.image.job.id=$GITHUB_JOB \ | ||
--label com.github.image.source.sha=$GITHUB_SHA \ | ||
--label com.github.image.source.branch=$GITHUB_REF \ | ||
-t "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_SHORTSHA" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_NUGETVERSIONV2" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_MAJOR.$GITVERSION_MINOR" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_MAJOR" \ | ||
--cache-from ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest \ | ||
--label com.github.image.run.id=${{ github.run_id }} \ | ||
--label com.github.image.run.number=${{ github.run_number }} \ | ||
--label com.github.image.job.id=${{ github.job }} \ | ||
--label com.github.image.source.sha=${{ github.sha }} \ | ||
--label com.github.image.source.branch=${{ github.ref }} \ | ||
-t "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.shortSha }}" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.nuGetVersionV2 }}" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.major}}.${{ steps.gitversion.outputs.minor }}" \ | ||
-t "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.major }}" \ | ||
--cache-from ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
. | ||
|
@@ -99,18 +99,18 @@ jobs: | |
- name: Push image (latest, ShortSha) | ||
if: ${{ (github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags') }} | ||
run: | | ||
docker push "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest" | ||
docker push "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_SHORTSHA" | ||
docker push "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest" | ||
docker push "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.shortSha}}" | ||
- name: Push image (NuGetVersionV2) | ||
if: ${{ !startsWith(github.ref, 'refs/pull') }} | ||
run: docker push "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_NUGETVERSIONV2" | ||
run: docker push "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.nuGetVersionV2 }}" | ||
|
||
- name: Push image (major, minor) | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: | | ||
docker push "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_MAJOR.$GITVERSION_MINOR" | ||
docker push "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$GITVERSION_MAJOR" | ||
docker push "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}" | ||
docker push "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.gitversion.outputs.major }}" | ||
- name: Publish Artifact | ||
uses: actions/upload-artifact@v4 | ||
|