ci: deploy to Fly using nix built container #17
This file contains 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: Fly Deploy | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
packages: write | |
jobs: | |
deploy: | |
name: Deploy app | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install nix | |
uses: DeterminateSystems/nix-installer-action@v9 | |
- name: Setup magic-nix-cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Build container | |
run: | | |
nix build .#container | |
- name: Upload container to ghcr.io | |
run: | | |
sudo -E nix run nixpkgs#skopeo -- \ | |
--insecure-policy copy \ | |
oci-archive:./result \ | |
"docker://ghcr.io/jnsgruk/jnsgr.uk:$GITHUB_SHA" \ | |
--dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" | |
- name: Deploy site | |
run: | | |
nix run nixpkgs#flyctl -- auth login -t ${{ secrets.FLY_API_TOKEN }} | |
nix run nixpkgs#flyctl -- deploy -i "ghcr.io/jnsgruk/jnsgr.uk:$GITHUB_SHA" |