-
Notifications
You must be signed in to change notification settings - Fork 16
44 lines (43 loc) · 1.55 KB
/
nix.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
name: "Nix build"
on:
pull_request:
push:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: "Basic CLI and web build"
run: |
nix build .#tclip .#tclipd
- name: "Docker image build (dry run)"
run: |
nix develop --command go run github.com/tailscale/mkctr --gopaths="./cmd/tclipd:/bin/tclipd" --tags="latest" --base="gcr.io/distroless/static" --repos=ghcr.io/tailscale-dev/tclip --ldflags="-w -s" -- /bin/tclipd
- name: "docker login"
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
if: "github.event_name == 'push' && github.ref_name == 'main'"
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Docker image push"
if: "github.event_name == 'push' && github.ref_name == 'main'"
run: |
nix develop --command go run github.com/tailscale/mkctr --gopaths="./cmd/tclipd:/bin/tclipd" --tags="latest" --base="gcr.io/distroless/static" --repos=ghcr.io/tailscale-dev/tclip --push --ldflags="-w -s" -- /bin/tclipd
- name: "Portable service build"
run: |
nix build .#portable-service
mkdir -p var
cp ./result/*.raw ./var
- uses: actions/upload-artifact@v3
with:
name: portable-service
path: ./var/*.raw