You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This workflow automatically builds and pushes Docker images to GitHub Container Registry (GHCR) when code is pushed to the `main` branch or when version tags are created.
6
+
7
+
### Triggers
8
+
9
+
-**Push to main branch**: Builds and tags as `latest`
10
+
-**Version tags** (e.g., `v1.0.0`): Builds with semantic versioning tags
11
+
12
+
### Required Secrets
13
+
14
+
You need to configure the following secrets in your GitHub repository settings:
15
+
16
+
1.**`GITHUB_TOKEN`** (automatically provided by GitHub)
17
+
- Used to authenticate with GitHub Container Registry
18
+
- No manual setup required
19
+
20
+
2.**`INFRA_REPO_TOKEN`** (required for deployment trigger)
21
+
- Personal Access Token (PAT) with `repo` scope
22
+
- Used to trigger deployment in infrastructure repository
23
+
- Create at: https://github.com/settings/tokens
24
+
25
+
3.**`INFRA_REPO_OWNER`** (required)
26
+
- GitHub username or organization that owns the infrastructure repo
27
+
- Example: `your-username` or `your-org`
28
+
29
+
4.**`INFRA_REPO_NAME`** (required)
30
+
- Name of your infrastructure repository
31
+
- Example: `amar-pathagar-infra`
32
+
33
+
### Setup Instructions
34
+
35
+
1.**Enable GitHub Container Registry**
36
+
```bash
37
+
# Make sure your repository has packages enabled
38
+
# Go to: Settings > Actions > General > Workflow permissions
39
+
# Enable: "Read and write permissions"
40
+
```
41
+
42
+
2.**Add Required Secrets**
43
+
```bash
44
+
# Go to: Settings > Secrets and variables > Actions > New repository secret
45
+
46
+
# Add INFRA_REPO_TOKEN
47
+
# - Name: INFRA_REPO_TOKEN
48
+
# - Value: Your GitHub Personal Access Token
49
+
50
+
# Add INFRA_REPO_OWNER
51
+
# - Name: INFRA_REPO_OWNER
52
+
# - Value: your-github-username
53
+
54
+
# Add INFRA_REPO_NAME
55
+
# - Name: INFRA_REPO_NAME
56
+
# - Value: amar-pathagar-infra
57
+
```
58
+
59
+
3.**Create a Personal Access Token**
60
+
- Go to: https://github.com/settings/tokens
61
+
- Click "Generate new token (classic)"
62
+
- Select scopes: `repo` (full control of private repositories)
63
+
- Copy the token and add it as `INFRA_REPO_TOKEN` secret
64
+
65
+
### Workflow Steps
66
+
67
+
1.**Checkout code**: Clones the repository
68
+
2.**Set up Docker Buildx**: Enables advanced Docker build features
69
+
3.**Login to GHCR**: Authenticates with GitHub Container Registry
70
+
4.**Extract metadata**: Generates Docker tags and labels
71
+
5.**Build and push**: Builds multi-platform images (amd64, arm64) and pushes to GHCR
72
+
6.**Trigger deployment**: Sends webhook to infrastructure repo for staging deployment
0 commit comments