-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (37 loc) · 1.19 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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@v14
- name: Setup magic-nix-cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container
run: |
nix build -L .#jnsgruk-container
- name: Upload container to ghcr.io
run: |
docker load < result
docker tag "jnsgruk/jnsgr.uk:$(git rev-parse --short HEAD)" "ghcr.io/jnsgruk/jnsgr.uk:$(git rev-parse --short HEAD)"
docker push "ghcr.io/jnsgruk/jnsgr.uk:$(git rev-parse --short HEAD)"
- name: Deploy site
run: |
nix run nixpkgs#flyctl -- deploy -i "ghcr.io/jnsgruk/jnsgr.uk:$(git rev-parse --short HEAD)"
env:
FLY_ACCESS_TOKEN: ${{ secrets.FLY_API_TOKEN }}