Skip to content

Commit 9908084

Browse files
authored
Allow container images for pull requests in fork branches (#1326)
2 parents d0c9daf + 9697936 commit 9908084

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

.github/workflows/release-image.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
name: "Build and publish Docker image"
22

33
on:
4+
pull_request:
5+
paths:
6+
- payjoin-service/**
47
push:
58
tags:
69
- payjoin-service-**
710
workflow_dispatch:
811

912
jobs:
10-
build:
13+
publish:
1114
name: "Build and publish Docker image"
15+
if: github.event_name != 'pull_request'
1216
strategy:
1317
fail-fast: false
1418
runs-on: ubuntu-latest
@@ -30,3 +34,38 @@ jobs:
3034

3135
- name: Build and release image
3236
run: nix run .#packages.x86_64-linux.payjoin-service-image.copyToRegistry
37+
38+
build-pr:
39+
name: "Build and upload image artifact"
40+
if: github.event_name == 'pull_request'
41+
strategy:
42+
fail-fast: false
43+
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
46+
packages: write
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
51+
- name: Install Nix
52+
uses: DeterminateSystems/nix-installer-action@main
53+
54+
- name: Build and save image artifact
55+
run: |
56+
TAG=$(git rev-parse --short HEAD)
57+
58+
nix build .#packages.x86_64-linux.payjoin-service-image.copyToDockerDaemon
59+
result/bin/copy-to-docker-daemon
60+
61+
docker save docker.io/payjoin/payjoin-service:${TAG} -o payjoin-service-${TAG}.tar
62+
63+
echo "Image saved: payjoin-service-${TAG}.tar"
64+
ls -lh payjoin-service-${TAG}.tar
65+
66+
- name: Upload image artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: payjoin-service-image-${{ github.sha }}
70+
path: payjoin-service-*.tar
71+
retention-days: 7

0 commit comments

Comments
 (0)