blob: bebf8853253ec49ca2e28b9b30a2b3fdbde241ba (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
name: ci
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
lint:
name: lint project
uses: ./.github/workflows/lint.yaml
format:
name: format project
uses: ./.github/workflows/format.yaml
build:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
output: [teawiebot, container]
steps:
- uses: actions/checkout@v3
- name: setup nix & cachix
uses: ./.github/actions/setup-nix
with:
cachix-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: build
run: |
nix build --accept-flake-config -L .#${{ matrix.output }}
- name: copy docker image
if: ${{ matrix.output == 'container' }}
run: |
readlink result | xargs -I{} cp {} teawiebot.tar.gz
- name: upload binary
if: ${{ matrix.output == 'teawiebot' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.output }}
path: result/bin/${{ matrix.output }}
- name: upload docker image
if: ${{ matrix.output == 'container' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.output }}
path: teawiebot.tar.gz
upload-to-docker:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
env:
REGISTRY: ghcr.io
steps:
- name: download docker image
uses: actions/download-artifact@v3
with:
name: container
- name: login to ghcr
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: "getchoo"
password: ${{ secrets.GITHUB_TOKEN }}
- name: upload to ghcr
run: |
docker load < teawiebot.tar.gz
docker tag teawiebot:latest ghcr.io/getchoo/teawiebot:latest
docker push ghcr.io/getchoo/teawiebot:latest
|