v0.1.11 #14
Workflow file for this run
This file contains hidden or 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
| name: Release | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Run full CI first — release only proceeds if all checks pass | |
| ci: | |
| name: CI | |
| uses: ./.github/workflows/ci.yml | |
| # Cross-compile for all platforms | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: ci | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| cross: false | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| cross: false | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| cross: true | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| cross: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross | |
| if: matrix.cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build release binary | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| - name: Package binary | |
| shell: bash | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| ARCHIVE_NAME=lattice-${VERSION}-${{ matrix.target }} | |
| mkdir -p dist/${ARCHIVE_NAME} | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| cp target/${{ matrix.target }}/release/lattice.exe dist/${ARCHIVE_NAME}/ | |
| else | |
| cp target/${{ matrix.target }}/release/lattice dist/${ARCHIVE_NAME}/ | |
| fi | |
| cp README.md LICENSE* dist/${ARCHIVE_NAME}/ 2>/dev/null || true | |
| cd dist | |
| tar -czvf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME} | |
| # Generate checksum | |
| if [[ "$OSTYPE" == "darwin"* ]]; then | |
| shasum -a 256 ${ARCHIVE_NAME}.tar.gz > ${ARCHIVE_NAME}.tar.gz.sha256 | |
| else | |
| sha256sum ${ARCHIVE_NAME}.tar.gz > ${ARCHIVE_NAME}.tar.gz.sha256 | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lattice-${{ matrix.target }} | |
| path: dist/*.tar.gz* | |
| # Upload binaries to the existing GitHub Release | |
| publish: | |
| name: Upload Release Assets | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| find artifacts -name '*.tar.gz' -exec mv {} release/ \; | |
| find artifacts -name '*.sha256' -exec mv {} release/ \; | |
| # Create combined checksums file | |
| cd release | |
| cat *.sha256 > checksums.txt | |
| rm -f *.sha256 | |
| - name: Upload assets to release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| for file in release/*; do | |
| gh release upload ${{ github.event.release.tag_name }} "$file" --clobber \ | |
| --repo ${{ github.repository }} | |
| done | |
| # Deploy documentation to GitHub Pages | |
| pages: | |
| name: Deploy to GitHub Pages | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download release binary from CI | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: lattice-linux | |
| path: bin | |
| - name: Generate documentation | |
| run: | | |
| chmod +x bin/lattice | |
| bin/lattice export --format pages --output _site | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # Deploy install script to S3 (served via forkzero.ai/lattice/) | |
| deploy-install-script: | |
| name: Deploy Install Script | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Upload install script to S3 | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: us-east-1 | |
| run: | | |
| aws s3 cp install.sh s3://forkzero-lattice-prod/lattice/install.sh \ | |
| --content-type "text/plain" | |
| aws s3 cp install.ps1 s3://forkzero-lattice-prod/lattice/install.ps1 \ | |
| --content-type "text/plain" | |
| - name: Invalidate CloudFront cache | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: us-east-1 | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id ${{ secrets.CF_DISTRIBUTION_ID }} \ | |
| --paths "/lattice/*" | |
| # Verify the published release works end-to-end via install script | |
| e2e-verify: | |
| name: E2E Verify Release | |
| needs: [publish, deploy-install-script] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install lattice via install script | |
| run: curl -fsSL ${{ vars.INSTALL_URL }} | sh | |
| - name: Run e2e tests | |
| run: bash tests/docker/e2e-test.sh | |
| # Verify the published release works on Windows | |
| e2e-verify-windows: | |
| name: E2E Verify Release (Windows) | |
| needs: [publish, deploy-install-script] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install lattice via install script | |
| shell: pwsh | |
| env: | |
| INSTALL_URL: ${{ vars.INSTALL_URL }} | |
| run: | | |
| $url = $env:INSTALL_URL -replace 'install\.sh$','install.ps1' | |
| irm $url | iex | |
| - name: Add lattice to PATH | |
| shell: pwsh | |
| run: echo "$env:LOCALAPPDATA\lattice" >> $env:GITHUB_PATH | |
| - name: Run Windows e2e tests | |
| shell: pwsh | |
| run: .\tests\e2e-windows.ps1 |