-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (125 loc) · 4.63 KB
/
publish.yml
File metadata and controls
129 lines (125 loc) · 4.63 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: Publish [post-garnix]
on:
check_suite:
types: [completed]
workflow_dispatch:
inputs:
tag:
description: "The existing tag to publish to FlakeHub"
type: string
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
publish-unstable-image:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
if: |
(
(github.ref == 'refs/heads/main' || github.event.check_suite.head_branch == 'main')
&& !contains(
github.event.head_commit.message
|| github.event.check_suite.head_commit.message
|| '',
'no-publish'
)
&& (
github.event_name == 'workflow_dispatch'
|| (
github.event.check_suite.app.slug == 'garnix'
&& github.event.check_suite.conclusion == 'success'
)
)
)
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/determinate-nix-action@v3
with:
extra-conf: |
extra-substituters = https://cache.garnix.io
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Build datomic-pro oci image
run: nix build .#datomic-pro-container -o container
- name: Push unstable container image
run: |
nix develop --ignore-environment --command skopeo copy --dest-creds="outskirtslabs:${{ github.token }}" docker-archive:./container docker://ghcr.io/outskirtslabs/datomic-pro:unstable
publish-release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
if: |
(
!contains(
github.event.head_commit.message
|| github.event.check_suite.head_commit.message
|| '',
'no-publish'
)
&& (
github.event_name == 'workflow_dispatch'
|| (
github.event.check_suite.app.slug == 'garnix'
&& github.event.check_suite.conclusion == 'success'
)
)
)
steps:
- name: Verify tag format
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
run: |
if [[ ! "${{ inputs.tag }}" =~ ^v ]]; then
echo "Error: Tag must start with 'v' prefix"
exit 1
fi
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: "${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.event.check_suite.head_sha || github.ref }}"
- name: Resolve release tag
id: release-tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
git fetch --tags --force
TAG="$(git tag --points-at HEAD | grep '^v' | head -n1 || true)"
fi
if [ -n "$TAG" ]; then
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "publish=true" >> "$GITHUB_OUTPUT"
echo "Resolved release tag: $TAG"
else
echo "publish=false" >> "$GITHUB_OUTPUT"
echo "No release tag on this commit; skipping release publish"
fi
- uses: DeterminateSystems/determinate-nix-action@v3
if: steps.release-tag.outputs.publish == 'true'
with:
extra-conf: |
extra-substituters = https://cache.garnix.io
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
- uses: DeterminateSystems/flakehub-cache-action@main
if: steps.release-tag.outputs.publish == 'true'
- name: Build datomic-pro oci image
if: steps.release-tag.outputs.publish == 'true'
run: nix build .#datomic-pro-container -o container
- name: Push versioned container image
if: steps.release-tag.outputs.publish == 'true'
run: |
datomic_version=$(grep "version =" pkgs/versions.nix | head -n1 | cut -d'"' -f2)
nix develop --ignore-environment --command skopeo copy --dest-creds="outskirtslabs:${{ github.token }}" docker-archive:./container "docker://ghcr.io/outskirtslabs/datomic-pro:${datomic_version}"
- uses: DeterminateSystems/flakehub-push@main
if: steps.release-tag.outputs.publish == 'true'
with:
visibility: public
name: outskirtslabs/datomic-pro
tag: "${{ steps.release-tag.outputs.tag }}"