Skip to content

feat: add session detach/attach for tmux-like persistence #31

feat: add session detach/attach for tmux-like persistence

feat: add session detach/attach for tmux-like persistence #31

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
id-token: write
packages: write
jobs:
check:
name: Nix Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run all checks
run: nix flake check --print-build-logs
build:
name: Build
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build package
run: nix build --print-build-logs
publish:
name: Publish to FlakeHub
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [check, build]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: DeterminateSystems/determinate-nix-action@v3
- uses: DeterminateSystems/flakehub-push@main
with:
name: andrewgazelka/tap
rolling: true
visibility: public
include-output-paths: true
docker:
name: Docker
runs-on: ubuntu-latest
needs: [check]
strategy:
matrix:
arch: [x86_64-linux, aarch64-linux]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
extra-platforms = aarch64-linux
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Set up QEMU for aarch64
if: matrix.arch == 'aarch64-linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build Docker image
run: |
nix build .#packages.${{ matrix.arch }}.docker --print-build-logs
./result > image-${{ matrix.arch }}.tar.gz
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: docker-image-${{ matrix.arch }}
path: image-${{ matrix.arch }}.tar.gz
retention-days: 1
docker-push:
name: Push to GHCR
runs-on: ubuntu-latest
needs: [docker]
steps:
- name: Download x86_64 image
uses: actions/download-artifact@v4
with:
name: docker-image-x86_64-linux
- name: Download aarch64 image
uses: actions/download-artifact@v4
with:
name: docker-image-aarch64-linux
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load and push images
run: |
# Determine tag based on event type
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
TAG="pr-${{ github.event.pull_request.number }}"
else
TAG="latest"
fi
REPO="ghcr.io/${{ github.repository_owner }}/tap"
# Load and tag x86_64 image
docker load < image-x86_64-linux.tar.gz
docker tag tap:latest "${REPO}:${TAG}-amd64"
docker push "${REPO}:${TAG}-amd64"
# Load and tag aarch64 image
docker load < image-aarch64-linux.tar.gz
docker tag tap:latest "${REPO}:${TAG}-arm64"
docker push "${REPO}:${TAG}-arm64"
# Create and push multi-arch manifest
docker manifest create "${REPO}:${TAG}" \
"${REPO}:${TAG}-amd64" \
"${REPO}:${TAG}-arm64"
docker manifest push "${REPO}:${TAG}"
echo "Pushed ${REPO}:${TAG}"
ci-passed:
name: CI Passed
runs-on: ubuntu-latest
needs: [check, build, docker-push]
if: always()
steps:
- name: Check all jobs passed
run: |
results=("${{ needs.check.result }}" "${{ needs.build.result }}" "${{ needs.docker-push.result }}")
for result in "${results[@]}"; do
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
echo "::error::CI failed"
exit 1
fi
done
echo "All CI jobs passed"