+58
.github/workflows/release.yml
+58
.github/workflows/release.yml
···
1
+
name: Release API Container
2
+
3
+
on:
4
+
push:
5
+
tags:
6
+
- 'v*'
7
+
8
+
jobs:
9
+
release:
10
+
runs-on: ubuntu-latest
11
+
defaults:
12
+
run:
13
+
working-directory: api
14
+
15
+
steps:
16
+
- name: Checkout code
17
+
uses: actions/checkout@v4
18
+
19
+
- name: Install Nix
20
+
uses: DeterminateSystems/nix-installer-action@main
21
+
with:
22
+
logger: pretty
23
+
24
+
- name: Setup Nix cache
25
+
uses: DeterminateSystems/magic-nix-cache-action@main
26
+
27
+
- name: Check flake
28
+
run: nix flake check --refresh
29
+
30
+
- name: Build Rust binary
31
+
run: nix build .#slices
32
+
33
+
- name: Build Docker image
34
+
run: nix build .#slicesImg
35
+
36
+
- name: Load Docker image
37
+
run: docker load < result
38
+
39
+
- name: Login to GitHub Container Registry
40
+
uses: docker/login-action@v3
41
+
with:
42
+
registry: ghcr.io
43
+
username: ${{ github.actor }}
44
+
password: ${{ secrets.GITHUB_TOKEN }}
45
+
46
+
- name: Extract tag name
47
+
id: tag
48
+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
49
+
50
+
- name: Tag for GitHub Container Registry
51
+
run: |
52
+
docker tag slices:latest ghcr.io/${{ github.repository }}/api:latest
53
+
docker tag slices:latest ghcr.io/${{ github.repository }}/api:${{ steps.tag.outputs.tag }}
54
+
55
+
- name: Push to GitHub Container Registry
56
+
run: |
57
+
docker push ghcr.io/${{ github.repository }}/api:latest
58
+
docker push ghcr.io/${{ github.repository }}/api:${{ steps.tag.outputs.tag }}