-
Notifications
You must be signed in to change notification settings - Fork 112
83 lines (70 loc) · 2.36 KB
/
Copy pathrelease-image.yml
File metadata and controls
83 lines (70 loc) · 2.36 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
name: "Build and publish Docker image"
on:
pull_request:
paths:
- payjoin-mailroom/**
push:
tags:
- payjoin-mailroom-[0-9]*
workflow_dispatch:
jobs:
publish:
name: "Build and publish Docker image"
if: github.event_name != 'pull_request'
strategy:
fail-fast: false
runs-on: ubuntu-26.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.PAYJOIN_DOCKER_RW }}
- name: Build and release image
env:
IMAGE_TAG: ${{ github.ref_name }}
# --impure is needed to pass env variables into the flake.
# This breaks deterministic builds but allows us to identify
# the image with the release tag name.
run: nix run --impure .#packages.x86_64-linux.payjoin-mailroom-image.copyToRegistry
build-pr:
name: "Build and upload image artifact"
if: github.event_name == 'pull_request'
strategy:
fail-fast: false
runs-on: ubuntu-26.04
permissions:
contents: read
packages: write
steps:
- name: Wait for other workflows
uses: lewagon/wait-on-check-action@v1.5.0
with:
ref: ${{ github.event.pull_request.head.sha }}
running-workflow-name: "Build and upload image artifact"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v6
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Build and save image artifact
run: |
TAG=$(git rev-parse --short HEAD)
nix build .#packages.x86_64-linux.payjoin-mailroom-image.copyToDockerDaemon
result/bin/copy-to-docker-daemon
docker save docker.io/payjoin/payjoin-mailroom:${TAG} -o payjoin-mailroom-${TAG}.tar
echo "Image saved: payjoin-mailroom-${TAG}.tar"
ls -lh payjoin-mailroom-${TAG}.tar
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: payjoin-mailroom-image-${{ github.sha }}
path: payjoin-mailroom-*.tar
retention-days: 7