forked from harpocrates-stellar/main
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (101 loc) · 3.89 KB
/
Copy pathrelease.yml
File metadata and controls
117 lines (101 loc) · 3.89 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
name: Release — Build and push Docker images
# Trigger on a published GitHub release (tag created through the UI or API).
# Images are tagged with both the semver release tag and "latest".
# Images are pushed to GitHub Container Registry (ghcr.io).
#
# Required secrets (set in repo Settings → Secrets and variables → Actions):
# VITE_API_BASE — public URL of the deployed backend
# VITE_STELLAR_RPC_URL — Stellar RPC endpoint
# VITE_STELLAR_READONLY_SOURCE — funded G… testnet account
# VITE_HARPOCRATES_REGISTRY_ID — deployed contract ID (C…)
#
# GITHUB_TOKEN is automatically provided; no manual secret needed for ghcr.io push.
on:
release:
types: [published]
permissions:
contents: read
packages: write # needed to push to ghcr.io
env:
REGISTRY: ghcr.io
BACKEND_IMAGE: ${{ github.repository_owner }}/harpocrates-backend
FRONTEND_IMAGE: ${{ github.repository_owner }}/harpocrates-frontend
jobs:
build-backend:
name: Build and push backend image
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push backend
uses: docker/build-push-action@v7
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
build-frontend:
name: Build and push frontend image
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push frontend
uses: docker/build-push-action@v7
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# VITE_* values are baked into the static bundle at build time.
# Store these in GitHub Actions secrets, not variables, since they
# include account addresses and contract IDs.
build-args: |
VITE_API_BASE=${{ secrets.VITE_API_BASE }}
VITE_STELLAR_RPC_URL=${{ secrets.VITE_STELLAR_RPC_URL }}
VITE_STELLAR_READONLY_SOURCE=${{ secrets.VITE_STELLAR_READONLY_SOURCE }}
VITE_HARPOCRATES_REGISTRY_ID=${{ secrets.VITE_HARPOCRATES_REGISTRY_ID }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64