Skip to content

Commit 621a874

Browse files
authored
Nightly release (#3028)
* Updating the nightly release process to not need the git tag anymore * Setting token for GitHub CLI * Using workflow name * Rather than comparing with hash on master, compare with last run on current branch * Setting default repo * Setting repo on each command * Grab second hash so that we do not detect ourselves * Little more logging
1 parent 5624708 commit 621a874

File tree

2 files changed

+16
-28
lines changed

2 files changed

+16
-28
lines changed

.github/workflows/nightly_release.yml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
schedule:
66
- cron: '0 9 * * *'
77

8+
env:
9+
GH_TOKEN: ${{ github.token }}
10+
811
defaults:
912
run:
1013
shell: pwsh
@@ -16,29 +19,23 @@ jobs:
1619
runs-on: ubuntu-latest
1720

1821
outputs:
19-
should_run: ${{ steps.check_tag.outputs.has_changed }}
22+
should_run: ${{ steps.check_for_changes.outputs.has_changed }}
2023

2124
steps:
22-
- uses: actions/checkout@v3
23-
with:
24-
fetch-depth: 0
25-
26-
- id: check_tag
27-
name: Check nightly_release tag
25+
- id: check_for_changes
26+
name: Check for changes
2827
run: |
29-
$nightlyReleaseHash = $(git rev-parse nightly_release)
30-
$masterHash = $(git rev-parse origin/master)
31-
$hasChanged = ($nightlyReleaseHash -ne $masterHash).ToString().ToLower()
28+
# Grab the last two run, since the latest run will be the current one executing
29+
$workflowList = gh run list --workflow "${{ github.workflow }}" --branch "${{ github.ref_name }}" --json databaseId --limit 2 --repo "${{ github.repository }}"
30+
$runId = ($workflowList | ConvertFrom-Json)[1].databaseId
31+
$lastRunHash = ((gh run view $runId --json headSha --repo "${{ github.repository }}") | ConvertFrom-Json).headSha
32+
33+
echo "Last hash $lastRunHash"
34+
echo "Current hash ${{ github.sha }}"
35+
36+
$hasChanged = ($lastRunHash -ne "${{ github.sha }}").ToString().ToLower()
3237
echo "Has updates $hasChanged"
3338
"has_changed=$hasChanged" >> $env:GITHUB_OUTPUT
34-
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 }}"
4239
4340
get_versions:
4441
needs: [check_for_changes]
@@ -71,11 +68,3 @@ jobs:
7168
- name: Push NuGets
7269
run: |
7370
dotnet nuget push nugets/*.nupkg --api-key ${{ secrets.PAT }} --source https://api.nuget.org/v3/index.json --skip-duplicate
74-
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/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
is-full-release: true
2626

27-
collect_contributors:
27+
build_release_notes:
2828
runs-on: ubuntu-latest
2929
name: Generate Release Notes
3030

@@ -96,7 +96,6 @@ jobs:
9696
name: IconChanges
9797
path: "IconChanges*.md"
9898

99-
10099
create_release:
101100
needs: [collect_contributors, build_artifacts, build_icon_changes]
102101
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)