feat(nightly): build nightlies from main shas (#4888)
Co-authored-by: Finn Herzfeld <fherzfeld@block.xyz>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
# This workflow is for nightly releases, automatically triggered at midnight US Eastern
|
# A release from main. Automatically triggered at midnight US Eastern.
|
||||||
|
|
||||||
name: Nightly Build
|
name: Nightly Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -12,6 +13,7 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: 'main'
|
default: 'main'
|
||||||
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -22,25 +24,30 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.set-version.outputs.version }}
|
version: ${{ steps.set-version.outputs.version }}
|
||||||
|
commit_sha: ${{ steps.get-commit.outputs.commit_sha }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.branch || github.ref }}
|
ref: main # Ensure we're building from latest main
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get commit info
|
||||||
|
id: get-commit
|
||||||
|
run: |
|
||||||
|
echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
echo "Building from commit: $(git rev-parse HEAD)"
|
||||||
|
echo "Latest commit: $(git log -1 --oneline)"
|
||||||
|
|
||||||
- name: Generate a nightly version
|
- name: Generate a nightly version
|
||||||
id: set-version
|
id: set-version
|
||||||
run: |
|
run: |
|
||||||
|
# Extract the version from Cargo.toml and add nightly tag with date and short commit
|
||||||
VERSION=$(grep '^version\s*=' Cargo.toml | head -n 1 | cut -d\" -f2)
|
VERSION=$(grep '^version\s*=' Cargo.toml | head -n 1 | cut -d\" -f2)
|
||||||
DATE=$(date -u +%Y%m%d)
|
DATE=$(date -u +%Y%m%d)
|
||||||
VERSION="${VERSION}-nightly.${DATE}"
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||||
|
VERSION="${VERSION}-nightly.${DATE}.${SHORT_SHA}"
|
||||||
# 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
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: $VERSION"
|
||||||
|
|
||||||
build-cli:
|
build-cli:
|
||||||
needs: [prepare-version]
|
needs: [prepare-version]
|
||||||
@@ -67,7 +74,9 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
with:
|
with:
|
||||||
version: ${{ needs.prepare-version.outputs.version }}
|
version: ${{ needs.prepare-version.outputs.version }}
|
||||||
signing: false
|
signing: true
|
||||||
|
secrets:
|
||||||
|
OSX_CODESIGN_ROLE: ${{ secrets.OSX_CODESIGN_ROLE }}
|
||||||
|
|
||||||
bundle-desktop-linux:
|
bundle-desktop-linux:
|
||||||
needs: [prepare-version]
|
needs: [prepare-version]
|
||||||
@@ -80,7 +89,10 @@ jobs:
|
|||||||
uses: ./.github/workflows/bundle-desktop-windows.yml
|
uses: ./.github/workflows/bundle-desktop-windows.yml
|
||||||
with:
|
with:
|
||||||
version: ${{ needs.prepare-version.outputs.version }}
|
version: ${{ needs.prepare-version.outputs.version }}
|
||||||
signing: false
|
signing: true
|
||||||
|
secrets:
|
||||||
|
WINDOW_SIGNING_ROLE: ${{ secrets.WINDOW_SIGNING_ROLE }}
|
||||||
|
WINDOW_SIGNING_ROLE_TAG: ${{ secrets.WINDOW_SIGNING_ROLE_TAG }}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
@@ -88,24 +100,8 @@ jobs:
|
|||||||
needs: [prepare-version, build-cli, install-script, bundle-desktop, bundle-desktop-linux, bundle-desktop-windows]
|
needs: [prepare-version, build-cli, install-script, bundle-desktop, bundle-desktop-linux, bundle-desktop-windows]
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
actions: read
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
- 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
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # pin@v4
|
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # pin@v4
|
||||||
@@ -129,4 +125,3 @@ jobs:
|
|||||||
omitBody: true
|
omitBody: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
makeLatest: false
|
makeLatest: false
|
||||||
omitPrereleaseDuringUpdate: true
|
|
||||||
|
|||||||
Reference in New Issue
Block a user