-
Notifications
You must be signed in to change notification settings - Fork 397
88 lines (79 loc) · 2.55 KB
/
uffizzi-build.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
88
name: Build PR Image
on:
pull_request:
types: [opened, synchronize, reopened, closed]
paths-ignore:
- docs/**
branches-ignore:
- release-please-*
jobs:
build-flagsmith:
name: Build and push `Flagsmith`
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
tags: ${{ steps.meta.outputs.tags }}
if: ${{ github.event.action != 'closed' }}
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Generate UUID image name
id: uuid
run: echo "UUID_WORKER=flagsmith-$(uuidgen --time)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: registry.uffizzi.com/${{ env.UUID_WORKER }}
tags: |
type=raw,value=30d
- name: Build and Push Image to registry.uffizzi.com - Uffizzi's ephemeral Registry
uses: depot/build-push-action@v1
with:
context: .
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
render-compose-file:
name: Render Docker Compose File
# Pass output of this workflow to another triggered by `workflow_run` event.
runs-on: ubuntu-latest
needs:
- build-flagsmith
outputs:
compose-file-cache-key: ${{ steps.hash.outputs.hash }}
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Render Compose File
run: |
FLAGSMITH_IMAGE=${{ needs.build-flagsmith.outputs.tags }}
export FLAGSMITH_IMAGE
# Render simple template from environment variables.
envsubst < docker-compose.uffizzi.yml > docker-compose.rendered.yml
cat docker-compose.rendered.yml
- name: Upload Rendered Compose File as Artifact
uses: actions/upload-artifact@v4
with:
name: preview-spec
path: |
docker-compose.rendered.yml
${{github.event_path}}
retention-days: 2
delete-preview:
name: Call for Preview Deletion
runs-on: ubuntu-latest
if: ${{ github.event.action == 'closed' }}
steps:
# If this PR is closing, we will not render a compose file nor pass it to the next workflow.
- name: Upload PR Event as Artifact
uses: actions/upload-artifact@v4
with:
name: preview-spec
path: ${{github.event_path}}
retention-days: 2