101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
name: release-smoke
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
- ".github/workflows/release-smoke.yml"
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- "apps/**"
|
|
- "crates/**"
|
|
- "README.md"
|
|
- "RELEASE_RUNBOOK.md"
|
|
- "SMOKE_RUNBOOK.md"
|
|
- "scripts/release/**"
|
|
|
|
jobs:
|
|
build-release-artifacts:
|
|
name: ${{ matrix.os }} / ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
archive_ext: tar.gz
|
|
binary_name: dbtool
|
|
- os: macos-13
|
|
target: x86_64-apple-darwin
|
|
archive_ext: tar.gz
|
|
binary_name: dbtool
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
archive_ext: zip
|
|
binary_name: dbtool.exe
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Resolve release metadata
|
|
shell: bash
|
|
run: |
|
|
version="$(node scripts/release/version.mjs)"
|
|
echo "APP_VERSION=$version" >> "$GITHUB_ENV"
|
|
echo "ARTIFACT_BASENAME=dbtool-$version-${{ matrix.target }}" >> "$GITHUB_ENV"
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release --bin dbtool
|
|
|
|
- name: Smoke binary on Unix
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: scripts/release/smoke-binary.sh "target/release/${{ matrix.binary_name }}"
|
|
|
|
- name: Smoke binary on Windows
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$binary = "target/release/${{ matrix.binary_name }}"
|
|
& $binary --help | Out-Host
|
|
& $binary --version | Out-Host
|
|
|
|
- name: Package Unix artifact
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: scripts/release/package-unix.sh "${{ matrix.target }}" "target/release/${{ matrix.binary_name }}"
|
|
|
|
- name: Package Windows artifact
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$artifactDir = Join-Path "dist" $env:ARTIFACT_BASENAME
|
|
New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null
|
|
Copy-Item "target/release/${{ matrix.binary_name }}" (Join-Path $artifactDir "${{ matrix.binary_name }}")
|
|
Copy-Item "README.md" (Join-Path $artifactDir "README.md")
|
|
Copy-Item "RELEASE_RUNBOOK.md" (Join-Path $artifactDir "RELEASE_RUNBOOK.md")
|
|
Copy-Item "SMOKE_RUNBOOK.md" (Join-Path $artifactDir "SMOKE_RUNBOOK.md")
|
|
|
|
$archivePath = "dist/$env:ARTIFACT_BASENAME.zip"
|
|
if (Test-Path $archivePath) {
|
|
Remove-Item $archivePath -Force
|
|
}
|
|
Compress-Archive -Path "$artifactDir/*" -DestinationPath $archivePath
|
|
|
|
$hash = (Get-FileHash -Path $archivePath -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
Set-Content -Path "$archivePath.sha256" -Value "$hash $(Split-Path $archivePath -Leaf)"
|
|
|
|
- name: Upload packaged artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.ARTIFACT_BASENAME }}
|
|
path: |
|
|
dist/${{ env.ARTIFACT_BASENAME }}.${{ matrix.archive_ext }}
|
|
dist/${{ env.ARTIFACT_BASENAME }}.${{ matrix.archive_ext }}.sha256
|
|
if-no-files-found: error
|