-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from AArnott/libtemplateUpdate
Merge latest Library.Template
- Loading branch information
Showing
37 changed files
with
537 additions
and
46 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 📚 Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
actions: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
publish-docs: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: ⚙ Install prerequisites | ||
run: ./init.ps1 -UpgradePrerequisites | ||
|
||
- run: dotnet docfx docfx/docfx.json | ||
name: 📚 Generate documentation | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: docfx/_site | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Library.Template update | ||
|
||
# PREREQUISITE: This workflow requires the repo to be configured to allow workflows to create pull requests. | ||
# Visit https://github.com/USER/REPO/settings/actions | ||
# Under "Workflow permissions" check "Allow GitHub Actions to create ...pull requests" | ||
# Click Save. | ||
|
||
on: | ||
schedule: | ||
- cron: "0 3 * * Mon" # Sun @ 8 or 9 PM Mountain Time (depending on DST) | ||
workflow_dispatch: | ||
|
||
jobs: | ||
merge: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | ||
|
||
- name: merge | ||
id: merge | ||
shell: pwsh | ||
run: | | ||
$LibTemplateBranch = & ./azure-pipelines/Get-LibTemplateBasis.ps1 -ErrorIfNotRelated | ||
if ($LASTEXITCODE -ne 0) { | ||
exit $LASTEXITCODE | ||
} | ||
git fetch https://github.com/aarnott/Library.Template $LibTemplateBranch | ||
if ($LASTEXITCODE -ne 0) { | ||
exit $LASTEXITCODE | ||
} | ||
$LibTemplateCommit = git rev-parse FETCH_HEAD | ||
git diff --stat ...FETCH_HEAD | ||
if ((git rev-list FETCH_HEAD ^HEAD --count) -eq 0) { | ||
Write-Host "There are no Library.Template updates to merge." | ||
echo "uptodate=true" >> $env:GITHUB_OUTPUT | ||
exit 0 | ||
} | ||
# Pushing commits that add or change files under .github/workflows will cause our workflow to fail. | ||
# But it usually isn't necessary because the target branch already has (or doesn't have) these changes. | ||
# So if the merged doesn't bring in any changes to these files, try the merge locally and push that | ||
# to keep github happy. | ||
if ((git rev-list FETCH_HEAD ^HEAD --count -- .github/workflows) -eq 0) { | ||
# Indeed there are no changes in that area. So merge locally to try to appease GitHub. | ||
git checkout -b auto/libtemplateUpdate | ||
git config user.name "Andrew Arnott" | ||
git config user.email "andrewarnott@live.com" | ||
git merge FETCH_HEAD | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Merge conflicts prevent creating the pull request. Please run tools/MergeFrom-Template.ps1 locally and push the result as a pull request." | ||
exit 2 | ||
} | ||
git -c http.extraheader="AUTHORIZATION: bearer $env:GH_TOKEN" push origin -u HEAD | ||
} else { | ||
Write-Host "Changes to github workflows are included in this update. Please run tools/MergeFrom-Template.ps1 locally and push the result as a pull request." | ||
exit 1 | ||
} | ||
- name: pull request | ||
shell: pwsh | ||
if: success() && steps.merge.outputs.uptodate != 'true' | ||
run: | | ||
# If there is already an active pull request, don't create a new one. | ||
$existingPR = gh pr list -H auto/libtemplateUpdate --json url | ConvertFrom-Json | ||
if ($existingPR) { | ||
Write-Host "::warning::Skipping pull request creation because one already exists at $($existingPR[0].url)" | ||
exit 0 | ||
} | ||
$prTitle = "Merge latest Library.Template" | ||
$prBody = "This merges the latest features and fixes from [Library.Template's branch](https://github.com/AArnott/Library.Template/tree/). | ||
⚠️ Do **not** squash this pull request when completing it. You must *merge* it. | ||
<details> | ||
<summary>Merge conflicts?</summary> | ||
Resolve merge conflicts locally by carrying out these steps: | ||
``` | ||
git fetch | ||
git checkout auto/libtemplateUpdate | ||
git merge origin/main | ||
# resolve conflicts | ||
git commit | ||
git push | ||
``` | ||
</details>" | ||
gh pr create -H auto/libtemplateUpdate -b $prBody -t $prTitle | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<# | ||
.SYNOPSIS | ||
Returns the name of the well-known branch in the Library.Template repository upon which HEAD is based. | ||
#> | ||
[CmdletBinding(SupportsShouldProcess = $true)] | ||
Param( | ||
[switch]$ErrorIfNotRelated | ||
) | ||
|
||
# This list should be sorted in order of decreasing specificity. | ||
$branchMarkers = @( | ||
@{ commit = 'fd0a7b25ccf030bbd16880cca6efe009d5b1fffc'; branch = 'microbuild' }; | ||
@{ commit = '05f49ce799c1f9cc696d53eea89699d80f59f833'; branch = 'main' }; | ||
) | ||
|
||
foreach ($entry in $branchMarkers) { | ||
if (git rev-list HEAD | Select-String -Pattern $entry.commit) { | ||
return $entry.branch | ||
} | ||
} | ||
|
||
if ($ErrorIfNotRelated) { | ||
Write-Error "Library.Template has not been previously merged with this repo. Please review https://github.com/AArnott/Library.Template/tree/main?tab=readme-ov-file#readme for instructions." | ||
exit 1 | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.