Files
tkmind_go/.github/workflows/nightly.yml
T
2025-09-26 23:44:38 -05:00

133 lines
4.1 KiB
YAML

# This workflow is for nightly releases, automatically triggered at midnight US Eastern
name: Nightly Build
on:
schedule:
# Run at midnight US Eastern (0500 UTC)
- cron: '0 5 * * *'
workflow_dispatch: # Allow manual triggering
inputs:
branch:
description: 'Branch to build from'
required: false
default: 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-version:
name: Prepare Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Generate a nightly version
id: set-version
run: |
VERSION=$(grep '^version\s*=' Cargo.toml | head -n 1 | cut -d\" -f2)
DATE=$(date -u +%Y%m%d)
VERSION="${VERSION}-nightly.${DATE}"
# validate
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-nightly\.[0-9]{8}$ ]]; then
echo "Error: Invalid version format: $VERSION"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
build-cli:
needs: [prepare-version]
uses: ./.github/workflows/build-cli.yml
with:
version: ${{ needs.prepare-version.outputs.version }}
install-script:
name: Upload Install Script
runs-on: ubuntu-latest
needs: [build-cli]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # pin@v4
with:
name: download_cli.sh
path: download_cli.sh
bundle-desktop:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop.yml
permissions:
id-token: write
contents: read
with:
version: ${{ needs.prepare-version.outputs.version }}
signing: false
bundle-desktop-linux:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop-linux.yml
with:
version: ${{ needs.prepare-version.outputs.version }}
bundle-desktop-windows:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop-windows.yml
with:
version: ${{ needs.prepare-version.outputs.version }}
signing: false
release:
name: Release
runs-on: ubuntu-latest
needs: [prepare-version, build-cli, install-script, bundle-desktop, bundle-desktop-linux, bundle-desktop-windows]
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
fetch-depth: 0 # Fetch all history for proper tagging
- name: Create tag
run: |
TAG="${{ needs.prepare-version.outputs.version }}"
echo "Creating tag: $TAG"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Nightly release $TAG - SHA: ${{ github.sha }} - Run: ${{ github.run_number }}"
git push origin "$TAG"
echo "Tag $TAG created successfully"
- name: Download all artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # pin@v4
with:
merge-multiple: true
# Create/update the nightly release
- name: Release nightly
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # pin@v1
with:
tag: ${{ needs.prepare-version.outputs.version }}
name: "Nightly ${{ needs.prepare-version.outputs.version }}"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
goose-*.tar.bz2
goose-*.zip
*.deb
*.rpm
download_cli.sh
allowUpdates: true
omitBody: true
prerelease: true
makeLatest: false
omitPrereleaseDuringUpdate: true