-
Notifications
You must be signed in to change notification settings - Fork 3.4k
70 lines (57 loc) · 2.24 KB
/
nightly_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Nightly Release
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * *'
env:
GH_TOKEN: ${{ github.token }}
defaults:
run:
shell: pwsh
jobs:
check_for_changes:
#This check prevents this from running on forks
if: ${{ github.repository == 'MaterialDesignInXAML/MaterialDesignInXamlToolkit' }}
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check_for_changes.outputs.has_changed }}
steps:
- id: check_for_changes
name: Check for changes
run: |
# Grab the last two run, since the latest run will be the current one executing
$workflowList = gh run list --workflow "${{ github.workflow }}" --branch "${{ github.ref_name }}" --json databaseId --limit 2 --repo "${{ github.repository }}"
$runId = ($workflowList | ConvertFrom-Json)[1].databaseId
$lastRunHash = ((gh run view $runId --json headSha --repo "${{ github.repository }}") | ConvertFrom-Json).headSha
echo "Last hash $lastRunHash"
echo "Current hash ${{ github.sha }}"
$hasChanged = ($lastRunHash -ne "${{ github.sha }}").ToString().ToLower()
echo "Has updates $hasChanged"
"has_changed=$hasChanged" >> $env:GITHUB_OUTPUT
get_versions:
needs: [check_for_changes]
if: ${{ needs.check_for_changes.outputs.should_run == 'true' }}
name: Get Versions
uses: ./.github/workflows/get_versions.yml
build_artifacts:
name: Build artifacts
needs: [get_versions, check_for_changes]
if: ${{ needs.check_for_changes.outputs.should_run == 'true' }}
uses: ./.github/workflows/build_artifacts.yml
with:
mdix-version: ${{ needs.get_versions.outputs.mdix-version }}
mdix-colors-version: ${{ needs.get_versions.outputs.mdix-colors-version }}
mdix-mahapps-version: ${{ needs.get_versions.outputs.mdix-colors-version }}
push_nugets:
needs: [build_artifacts]
runs-on: ubuntu-latest
name: Push NuGets
steps:
- name: Download NuGet Artifacts
uses: actions/download-artifact@v3
with:
name: NuGets
path: nugets
- name: Push NuGets
run: |
dotnet nuget push nugets/*.nupkg --api-key ${{ secrets.PAT }} --source https://api.nuget.org/v3/index.json --skip-duplicate