-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (85 loc) · 3.21 KB
/
ci.yml
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
86
87
---
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
on:
push:
pull_request:
workflow_dispatch:
inputs:
tag:
description: "The existing tag to publish to FlakeHub"
type: "string"
required: true
jobs:
check:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Build datomic-pro nix package
run: nix build .#datomic-pro
- name: Build datomic-pro oci image
run: nix build .#datomic-pro-container -o container
- name: Build datomic-pro oci image unstable
run: nix build .#datomic-pro-container-unstable -o container
- name: Build datomic-pro-peer nix package
run: nix build .#datomic-pro-peer
- name: Run NixOS module tests
run: nix flake check
publish-unstable-image:
needs: check
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
# if we are on the main branch
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build datomic-pro oci image
run: nix build .#datomic-pro-container -o container
- name: Push container image on new releases
run: |
nix develop --ignore-environment --command skopeo copy --dest-creds="ramblurr:${{ github.token }}" docker-archive:./container docker://ghcr.io/ramblurr/datomic-pro:unstable
publish:
needs: check
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
if: startsWith(github.ref, 'refs/tags/v') || inputs.tag != null
steps:
- name: Verify tag format
if: github.event_name == 'workflow_dispatch'
run: |
if [[ ! "${{ inputs.tag }}" =~ ^v ]]; then
echo "Error: Tag must start with 'v' prefix"
exit 1
fi
- uses: actions/checkout@v4
with:
ref: "${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.ref }}"
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build datomic-pro oci image
run: nix build .#datomic-pro-container -o container
- name: Push container image on new releases
run: |
datomic_version=$(grep 'version = ' pkgs/datomic-pro.nix | cut -d'"' -f2)
nix develop --ignore-environment --command skopeo copy --dest-creds="ramblurr:${{ github.token }}" docker-archive:./container docker://ghcr.io/ramblurr/datomic-pro:$datomic_version
- uses: DeterminateSystems/flakehub-push@main
with:
visibility: public
name: Ramblurr/datomic-pro
tag: "${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}"