Skip to content

Nightly beta

Nightly beta #3

Workflow file for this run

name: Nightly beta
on:
schedule:
- cron: '30 5 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
tag:
name: Tag a beta when main moved
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
tag: ${{ steps.plan.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Plan and push beta tag
id: plan
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
./.github/scripts/Test-WorkflowSyntax.ps1
$head = (git rev-parse HEAD).Trim()
$latest = (git tag --list 'v*' --sort=-creatordate | Select-Object -First 1)
if ($latest) {
$latestSha = (git rev-list -n 1 $latest).Trim()
if ($latestSha -eq $head) { Write-Host "No commits since $latest; nothing to tag."; exit 0 }
}
$zone = [TimeZoneInfo]::FindSystemTimeZoneById('America/Chicago')
$today = [TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), $zone).ToString('yyyy.M.d')
$pattern = "^v$([regex]::Escape($today))\.(\d+)(-[A-Za-z0-9]{4})?$"
$highest = -1
foreach ($t in @(git tag --list "v$today.*")) {
if ($t -match $pattern -and [int]$Matches[1] -gt $highest) { $highest = [int]$Matches[1] }
}
$tag = "v$today.$($highest + 1)-beta"
./.github/scripts/Assert-ReleaseVersionSequence.ps1 -Tag $tag
git -c user.name='github-actions[bot]' -c user.email='41898282+github-actions[bot]@users.noreply.github.com' tag -a $tag -m $tag $head
if ($LASTEXITCODE -ne 0) { throw "git tag failed ($LASTEXITCODE)" }
$remote = "https://x-access-token:$($env:GH_TOKEN)@github.com/${{ github.repository }}.git"
git push $remote $tag
if ($LASTEXITCODE -ne 0) { throw "git push failed ($LASTEXITCODE)" }
Add-Content -LiteralPath $env:GITHUB_OUTPUT -Value "tag=$tag"
Write-Host "Pushed $tag at $head"
release:
name: Release the beta
needs: tag
if: needs.tag.outputs.tag != ''
permissions:
contents: write
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.tag.outputs.tag }}