Skip to content

Commit f075b30

Browse files
authored
Updating workflows (#3024)
* Last set of changes for release automation * Switching to re-usable workflows * Fixing version variables * Fixing missing env * Fixing shell to always use pwsh * Fixing reference to puling the git ref * Fixing version names typos * Displaying the boolean result * Debug output * Fixing output * Fixing output for shell * Updating workflows to be real now
1 parent eb45dbd commit f075b30

File tree

9 files changed

+207
-199
lines changed

9 files changed

+207
-199
lines changed

.github/actions/build-and-test/action.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/actions/push-artifacts/action.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/build_artifacts.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build Artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build-configuration:
7+
default: 'Release'
8+
required: false
9+
type: string
10+
mdix-version:
11+
required: true
12+
type: string
13+
mdix-colors-version:
14+
required: true
15+
type: string
16+
mdix-mahapps-version:
17+
required: true
18+
type: string
19+
20+
21+
jobs:
22+
build:
23+
name: Build and Test
24+
runs-on: windows-latest
25+
26+
env:
27+
solution: MaterialDesignToolkit.Full.sln
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v2
36+
with:
37+
dotnet-version: |
38+
3.1.x
39+
5.x
40+
6.x
41+
7.x
42+
43+
- name: Restore dependencies
44+
run: dotnet restore ${{ env.solution }}
45+
46+
- name: Build
47+
run: dotnet build ${{ env.solution }} --configuration ${{ inputs.build-configuration }} --no-restore -p:Platform="Any CPU" -p:TreatWarningsAsErrors=True
48+
49+
- name: Test
50+
timeout-minutes: 20
51+
run: dotnet test ${{ env.solution }} --configuration ${{ inputs.build-configuration }} --no-build --verbosity normal --blame-crash
52+
53+
- name: Upload Screenshots
54+
if: ${{ always() }}
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: Screenshots-${{ github.run_number }}
58+
path: ${{ github.workspace }}/MaterialDesignThemes.UITests/bin/${{ inputs.build-configuration }}/net7.0-windows/Screenshots
59+
if-no-files-found: ignore
60+
61+
- name: Build NuGets
62+
run: .\Scripts\BuildNugets.ps1 -MDIXVersion ${{ inputs.mdix-version }} -MDIXColorsVersion ${{ inputs.mdix-colors-version }} -MDIXMahAppsVersion ${{ inputs.mdix-mahapps-version }}
63+
64+
- name: Upload NuGets
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: NuGets
68+
path: "*.nupkg"
69+
70+
- name: Upload Demo App
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: DemoApp
74+
path: "MainDemo.Wpf/bin/${{ env.buildConfiguration }}"

.github/workflows/get_versions.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Setup Versions
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
is-full-release:
7+
required: false
8+
type: boolean
9+
default: false
10+
11+
outputs:
12+
mdix-version:
13+
description: "The version for the MaterialDesignThemes library"
14+
value: ${{ jobs.getting_versions.outputs.mdix-version }}
15+
mdix-colors-version:
16+
description: "The version for the MaterialDesignColors library"
17+
value: ${{ jobs.getting_versions.outputs.mdix-colors-version }}
18+
mdix-mahapps-version:
19+
description: "The version for the MaterialDesignThemes.MahApps library"
20+
value: ${{ jobs.getting_versions.outputs.mdix-mahapps-version }}
21+
22+
jobs:
23+
getting_versions:
24+
env:
25+
#Update these base version numbers
26+
mdix-version: "4.7.0"
27+
mdix-colors-version: "2.1.0"
28+
mdix-mahapps-version: "0.2.6"
29+
name: Set version numbers
30+
runs-on: ubuntu-latest
31+
defaults:
32+
run:
33+
shell: pwsh
34+
# Map the job outputs to step outputs
35+
outputs:
36+
mdix-version: ${{ steps.output_versions.outputs.mdix-version }}
37+
mdix-colors-version: ${{ steps.output_versions.outputs.mdix-colors-version }}
38+
mdix-mahapps-version: ${{ steps.output_versions.outputs.mdix-mahapps-version }}
39+
steps:
40+
- name: Set preview version numbers
41+
if: ${{ !inputs.is-full-release }}
42+
run: |
43+
"mdix-version=${{ env.mdix-version }}-ci${{ github.run_number }}" >> $env:GITHUB_ENV
44+
"mdix-colors-version=${{ env.mdix-colors-version }}-ci${{ github.run_number }}" >> $env:GITHUB_ENV
45+
"mdix-mahapps-version=${{ env.mdix-mahapps-version }}-ci${{ github.run_number }}" >> $env:GITHUB_ENV
46+
- name: Output Versions
47+
id: output_versions
48+
run: |
49+
echo ${{ env.mdix-version }}
50+
"mdix-version=${{ env.mdix-version }}" >> $env:GITHUB_OUTPUT
51+
echo ${{ env.mdix-colors-version }}
52+
"mdix-colors-version=${{ env.mdix-colors-version }}" >> $env:GITHUB_OUTPUT
53+
echo ${{ env.mdix-mahapps-version }}
54+
"mdix-mahapps-version=${{ env.mdix-mahapps-version }}" >> $env:GITHUB_OUTPUT

.github/workflows/icon_update.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
build:
10+
#This check prevents this from running on forks
1011
if: ${{ github.repository == 'MaterialDesignInXAML/MaterialDesignInXamlToolkit' }}
1112

1213
runs-on: windows-latest

.github/workflows/nightly_release.yml

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,78 @@ on:
44
workflow_dispatch:
55
schedule:
66
- cron: '0 9 * * *'
7-
# push:
8-
# tags:
9-
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
107

11-
env:
12-
solution: MaterialDesignToolkit.Full.sln
13-
buildConfiguration: 'Release'
14-
mdixColorsVersion: '2.1.0'
15-
mdixMahAppsVersion: '0.2.6'
16-
mdixVersion: '4.7.0'
8+
defaults:
9+
run:
10+
shell: pwsh
1711

1812
jobs:
1913
check_for_changes:
14+
#This check prevents this from running on forks
2015
if: ${{ github.repository == 'MaterialDesignInXAML/MaterialDesignInXamlToolkit' }}
21-
runs-on: windows-latest
16+
runs-on: ubuntu-latest
2217

2318
outputs:
24-
should_run: ${{ github.event_name == 'push' || steps.check_tag.outputs.has_changed }}
19+
should_run: ${{ steps.check_tag.outputs.has_changed }}
2520

2621
steps:
2722
- uses: actions/checkout@v3
28-
if: ${{ github.event_name != 'push' }}
2923
with:
3024
fetch-depth: 0
3125

3226
- id: check_tag
3327
name: Check nightly_release tag
34-
if: ${{ github.event_name != 'push' }}
3528
run: |
3629
$nightlyReleaseHash = $(git rev-parse nightly_release)
37-
$masterHash = $(git rev-parse master)
30+
$masterHash = $(git rev-parse origin/master)
3831
$hasChanged = ($nightlyReleaseHash -ne $masterHash).ToString().ToLower()
39-
echo "::set-output name=has_changed::$hasChanged"
32+
echo "Has updates $hasChanged"
33+
"has_changed=$hasChanged" >> $env:GITHUB_OUTPUT
4034
41-
build:
35+
test:
36+
needs: check_for_changes
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Test
40+
run: |
41+
echo "Test ${{ needs.check_for_changes.outputs.should_run }}"
42+
43+
get_versions:
4244
needs: [check_for_changes]
4345
if: ${{ needs.check_for_changes.outputs.should_run == 'true' }}
44-
runs-on: windows-latest
46+
name: Get Versions
47+
uses: ./.github/workflows/get_versions.yml
4548

46-
steps:
47-
- uses: actions/checkout@v3
48-
with:
49-
fetch-depth: 0
49+
build_artifacts:
50+
name: Build artifacts
51+
needs: [get_versions, check_for_changes]
52+
if: ${{ needs.check_for_changes.outputs.should_run == 'true' }}
53+
uses: ./.github/workflows/build_artifacts.yml
54+
with:
55+
mdix-version: ${{ needs.get_versions.outputs.mdix-version }}
56+
mdix-colors-version: ${{ needs.get_versions.outputs.mdix-colors-version }}
57+
mdix-mahapps-version: ${{ needs.get_versions.outputs.mdix-colors-version }}
5058

51-
- name: Build and Test
52-
uses: ./.github/actions/build-and-test
53-
timeout-minutes: 20
54-
with:
55-
solution: ${{ env.solution }}
56-
buildConfiguration: ${{ env.buildConfiguration }}
57-
nugetKey: ${{ secrets.PAT }}
59+
push_nugets:
60+
needs: [build_artifacts]
61+
runs-on: ubuntu-latest
62+
name: Push NuGets
5863

59-
- name: Set Nightly Version Numbers
60-
if: ${{ github.event_name != 'push' }}
61-
run: |
62-
echo "mdixVersion=${{ env.mdixVersion }}-ci${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
63-
echo "mdixColorsVersion=${{ env.mdixColorsVersion }}-ci${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
64-
echo "mdixMahAppsVersion=${{ env.mdixMahAppsVersion }}-ci${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
65-
66-
# - name: Push Artifacts
67-
# uses: ./.github/actions/push-artifacts
68-
# timeout-minutes: 10
69-
# with:
70-
# mdixVersion: ${{ env.mdixVersion }}
71-
# mdixColorsVersion: ${{ env.mdixColorsVersion }}
72-
# mdixMahAppsVersion: ${{ env.mdixMahappsVersion }}
73-
# demoAppPath: "MainDemo.Wpf/bin/${{ env.buildConfiguration }}"
74-
# nugetKey: ${{ secrets.PAT }}
64+
steps:
65+
- name: Download NuGet Artifacts
66+
uses: actions/download-artifact@v3
67+
with:
68+
name: NuGets
69+
path: nugets
70+
71+
- name: Push NuGets
72+
run: |
73+
dotnet nuget push nugets/*.nupkg --api-key ${{ secrets.PAT }} --source https://api.nuget.org/v3/index.json --skip-duplicate
7574
76-
# - name: Update latest tag
77-
# if: ${{ github.event_name != 'push' }}
78-
# run: |
79-
# git config user.name github-actions
80-
# git config user.email [email protected]
81-
# git tag -f nightly_release master
82-
# git push -f --tags
75+
- name: Update latest tag
76+
if: ${{ github.event_name != 'push' }}
77+
run: |
78+
git config user.name github-actions
79+
git config user.email [email protected]
80+
git tag -f nightly_release master
81+
git push -f --tags

.github/workflows/pr_verification.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ on:
66
pull_request:
77
branches: [ master ]
88

9+
defaults:
10+
run:
11+
shell: pwsh
12+
913
env:
1014
solution: MaterialDesignToolkit.Full.sln
1115
buildConfiguration: 'Release'
1216

1317
jobs:
1418
build:
15-
16-
runs-on: windows-latest
17-
18-
steps:
19-
- uses: actions/checkout@v3
20-
21-
- name: Build and Test
22-
uses: ./.github/actions/build-and-test
23-
timeout-minutes: 20
24-
with:
25-
solution: ${{ env.solution }}
26-
buildConfiguration: ${{ env.buildConfiguration }}
27-
nugetKey: ${{ secrets.PAT }}
19+
name: Build artifacts
20+
uses: ./.github/workflows/build_artifacts.yml
21+
with:
22+
mdix-version: "0.0.0"
23+
mdix-colors-version: "0.0.0"
24+
mdix-mahapps-version: "0.0.0"
2825

2926
automerge:
3027
needs: build
@@ -35,4 +32,4 @@ jobs:
3532
contents: write
3633

3734
steps:
38-
- uses: fastify/[email protected]
35+
- uses: fastify/[email protected]

0 commit comments

Comments
 (0)