v2.2.1 99f5ba4

github-actions.md RawHistoryFolder

GitHub Actions Deployment

Automated deployment with GitHub Actions using Gordon's official action.

Prerequisites

  1. Gordon server running with registry authentication enabled
  2. Generated deployment token
  3. GitHub repository secrets configured

Quick Setup

1. Generate Deployment Token

On your Gordon server:

gordon auth token generate --subject github-actions --scopes push,pull --expiry 0

Save the token output.

2. Add GitHub Secrets

In your repository: Settings → Secrets → Actions → New repository secret

Secret Value
GORDON_REGISTRY registry.mydomain.com
GORDON_USERNAME github-actions
GORDON_TOKEN The generated token

3. Create Workflow

Create .github/workflows/deploy.yml:

name: Deploy to Gordon

on:
  push:
    tags:
      - 'v*'

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to Gordon
        uses: bnema/gordon/.github/actions/deploy@main
        with:
          registry: ${{ secrets.GORDON_REGISTRY }}
          username: ${{ secrets.GORDON_USERNAME }}
          password: ${{ secrets.GORDON_TOKEN }}

4. Deploy

git tag v1.0.0
git push origin v1.0.0

Action Reference

Inputs

Input Required Default Description
registry Yes - Gordon registry URL
username Yes - Registry username
password Yes - Registry token
image No repo name Image name
tag No git tag/SHA Image tag
dockerfile No ./Dockerfile Dockerfile path
context No . Build context
push-latest No false Also push :latest tag
platforms No linux/amd64 Target platforms
build-args No - Build arguments

Outputs

Output Description
image Full image name
tag Image tag

Workflow Examples

Deploy on Tag Push

name: Deploy to Gordon

on:
  push:
    tags:
      - 'v*'

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to Gordon
        uses: bnema/gordon/.github/actions/deploy@main
        with:
          registry: ${{ secrets.GORDON_REGISTRY }}
          username: ${{ secrets.GORDON_USERNAME }}
          password: ${{ secrets.GORDON_TOKEN }}

Continuous Deployment

Deploy on every push to main:

name: Deploy to Gordon

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to Gordon
        uses: bnema/gordon/.github/actions/deploy@main
        with:
          registry: ${{ secrets.GORDON_REGISTRY }}
          username: ${{ secrets.GORDON_USERNAME }}
          password: ${{ secrets.GORDON_TOKEN }}
          push-latest: 'true'

Manual Deployment

Allow manual deployments with custom tag:

name: Deploy to Gordon

on:
  workflow_dispatch:
    inputs:
      tag:
        description: 'Tag to deploy'
        required: false

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.inputs.tag || github.ref }}

      - name: Deploy to Gordon
        uses: bnema/gordon/.github/actions/deploy@main
        with:
          registry: ${{ secrets.GORDON_REGISTRY }}
          username: ${{ secrets.GORDON_USERNAME }}
          password: ${{ secrets.GORDON_TOKEN }}
          tag: ${{ github.event.inputs.tag }}

Monorepo Deployment

Deploy multiple services:

name: Deploy Services

on:
  push:
    tags:
      - 'v*'

jobs:
  deploy-api:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: bnema/gordon/.github/actions/deploy@main
        with:
          registry: ${{ secrets.GORDON_REGISTRY }}
          username: ${{ secrets.GORDON_USERNAME }}
          password: ${{ secrets.GORDON_TOKEN }}
          image: myapp-api
          dockerfile: ./services/api/Dockerfile
          context: ./services/api

  deploy-web:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: bnema/gordon/.github/actions/deploy@main
        with:
          registry: ${{ secrets.GORDON_REGISTRY }}
          username: ${{ secrets.GORDON_USERNAME }}
          password: ${{ secrets.GORDON_TOKEN }}
          image: myapp-web
          dockerfile: ./services/web/Dockerfile
          context: ./services/web

With Build Arguments

- uses: bnema/gordon/.github/actions/deploy@main
  with:
    registry: ${{ secrets.GORDON_REGISTRY }}
    username: ${{ secrets.GORDON_USERNAME }}
    password: ${{ secrets.GORDON_TOKEN }}
    build-args: |
      NODE_ENV=production
      API_URL=https://api.example.com
      BUILD_DATE=${{ github.event.head_commit.timestamp }}

Multi-Platform Build

- uses: bnema/gordon/.github/actions/deploy@main
  with:
    registry: ${{ secrets.GORDON_REGISTRY }}
    username: ${{ secrets.GORDON_USERNAME }}
    password: ${{ secrets.GORDON_TOKEN }}
    platforms: linux/amd64,linux/arm64

Deployment Summary

Add a deployment summary to your workflow:

- name: Deploy to Gordon
  id: deploy
  uses: bnema/gordon/.github/actions/deploy@main
  with:
    registry: ${{ secrets.GORDON_REGISTRY }}
    username: ${{ secrets.GORDON_USERNAME }}
    password: ${{ secrets.GORDON_TOKEN }}

- name: Deployment Summary
  run: |
    echo "## Deployment Complete" >> $GITHUB_STEP_SUMMARY
    echo "" >> $GITHUB_STEP_SUMMARY
    echo "**Image:** \`${{ steps.deploy.outputs.image }}\`" >> $GITHUB_STEP_SUMMARY
    echo "**Tag:** \`${{ steps.deploy.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY

Troubleshooting

Authentication Failed

Error: unauthorized: authentication required

Solution: Verify secrets are correctly set and token has push scope.

Image Not Found After Push

Solution: Ensure Gordon config has a route for the pushed image.

Build Fails

Solution: Check Dockerfile path and build context settings.

source
1# GitHub Actions Deployment
2
3Automated deployment with GitHub Actions using Gordon's official action.
4
5## Prerequisites
6
71. Gordon server running with registry authentication enabled
82. Generated deployment token
93. GitHub repository secrets configured
10
11## Quick Setup
12
13### 1. Generate Deployment Token
14
15On your Gordon server:
16
17```bash
18gordon auth token generate --subject github-actions --scopes push,pull --expiry 0
19```
20
21Save the token output.
22
23### 2. Add GitHub Secrets
24
25In your repository: Settings → Secrets → Actions → New repository secret
26
27| Secret | Value |
28|--------|-------|
29| `GORDON_REGISTRY` | `registry.mydomain.com` |
30| `GORDON_USERNAME` | `github-actions` |
31| `GORDON_TOKEN` | The generated token |
32
33### 3. Create Workflow
34
35Create `.github/workflows/deploy.yml`:
36
37```yaml
38name: Deploy to Gordon
39
40on:
41  push:
42    tags:
43      - 'v*'
44
45jobs:
46  deploy:
47    runs-on: ubuntu-latest
48    steps:
49      - uses: actions/checkout@v4
50
51      - name: Deploy to Gordon
52        uses: bnema/gordon/.github/actions/deploy@main
53        with:
54          registry: ${{ secrets.GORDON_REGISTRY }}
55          username: ${{ secrets.GORDON_USERNAME }}
56          password: ${{ secrets.GORDON_TOKEN }}
57```
58
59### 4. Deploy
60
61```bash
62git tag v1.0.0
63git push origin v1.0.0
64```
65
66## Action Reference
67
68### Inputs
69
70| Input | Required | Default | Description |
71|-------|----------|---------|-------------|
72| `registry` | Yes | - | Gordon registry URL |
73| `username` | Yes | - | Registry username |
74| `password` | Yes | - | Registry token |
75| `image` | No | repo name | Image name |
76| `tag` | No | git tag/SHA | Image tag |
77| `dockerfile` | No | `./Dockerfile` | Dockerfile path |
78| `context` | No | `.` | Build context |
79| `push-latest` | No | `false` | Also push :latest tag |
80| `platforms` | No | `linux/amd64` | Target platforms |
81| `build-args` | No | - | Build arguments |
82
83### Outputs
84
85| Output | Description |
86|--------|-------------|
87| `image` | Full image name |
88| `tag` | Image tag |
89
90## Workflow Examples
91
92### Deploy on Tag Push
93
94```yaml
95name: Deploy to Gordon
96
97on:
98  push:
99    tags:
100      - 'v*'
101
102jobs:
103  deploy:
104    runs-on: ubuntu-latest
105    steps:
106      - uses: actions/checkout@v4
107
108      - name: Deploy to Gordon
109        uses: bnema/gordon/.github/actions/deploy@main
110        with:
111          registry: ${{ secrets.GORDON_REGISTRY }}
112          username: ${{ secrets.GORDON_USERNAME }}
113          password: ${{ secrets.GORDON_TOKEN }}
114```
115
116### Continuous Deployment
117
118Deploy on every push to main:
119
120```yaml
121name: Deploy to Gordon
122
123on:
124  push:
125    branches:
126      - main
127
128jobs:
129  deploy:
130    runs-on: ubuntu-latest
131    steps:
132      - uses: actions/checkout@v4
133
134      - name: Deploy to Gordon
135        uses: bnema/gordon/.github/actions/deploy@main
136        with:
137          registry: ${{ secrets.GORDON_REGISTRY }}
138          username: ${{ secrets.GORDON_USERNAME }}
139          password: ${{ secrets.GORDON_TOKEN }}
140          push-latest: 'true'
141```
142
143### Manual Deployment
144
145Allow manual deployments with custom tag:
146
147```yaml
148name: Deploy to Gordon
149
150on:
151  workflow_dispatch:
152    inputs:
153      tag:
154        description: 'Tag to deploy'
155        required: false
156
157jobs:
158  deploy:
159    runs-on: ubuntu-latest
160    steps:
161      - uses: actions/checkout@v4
162        with:
163          ref: ${{ github.event.inputs.tag || github.ref }}
164
165      - name: Deploy to Gordon
166        uses: bnema/gordon/.github/actions/deploy@main
167        with:
168          registry: ${{ secrets.GORDON_REGISTRY }}
169          username: ${{ secrets.GORDON_USERNAME }}
170          password: ${{ secrets.GORDON_TOKEN }}
171          tag: ${{ github.event.inputs.tag }}
172```
173
174### Monorepo Deployment
175
176Deploy multiple services:
177
178```yaml
179name: Deploy Services
180
181on:
182  push:
183    tags:
184      - 'v*'
185
186jobs:
187  deploy-api:
188    runs-on: ubuntu-latest
189    steps:
190      - uses: actions/checkout@v4
191      - uses: bnema/gordon/.github/actions/deploy@main
192        with:
193          registry: ${{ secrets.GORDON_REGISTRY }}
194          username: ${{ secrets.GORDON_USERNAME }}
195          password: ${{ secrets.GORDON_TOKEN }}
196          image: myapp-api
197          dockerfile: ./services/api/Dockerfile
198          context: ./services/api
199
200  deploy-web:
201    runs-on: ubuntu-latest
202    steps:
203      - uses: actions/checkout@v4
204      - uses: bnema/gordon/.github/actions/deploy@main
205        with:
206          registry: ${{ secrets.GORDON_REGISTRY }}
207          username: ${{ secrets.GORDON_USERNAME }}
208          password: ${{ secrets.GORDON_TOKEN }}
209          image: myapp-web
210          dockerfile: ./services/web/Dockerfile
211          context: ./services/web
212```
213
214### With Build Arguments
215
216```yaml
217- uses: bnema/gordon/.github/actions/deploy@main
218  with:
219    registry: ${{ secrets.GORDON_REGISTRY }}
220    username: ${{ secrets.GORDON_USERNAME }}
221    password: ${{ secrets.GORDON_TOKEN }}
222    build-args: |
223      NODE_ENV=production
224      API_URL=https://api.example.com
225      BUILD_DATE=${{ github.event.head_commit.timestamp }}
226```
227
228### Multi-Platform Build
229
230```yaml
231- uses: bnema/gordon/.github/actions/deploy@main
232  with:
233    registry: ${{ secrets.GORDON_REGISTRY }}
234    username: ${{ secrets.GORDON_USERNAME }}
235    password: ${{ secrets.GORDON_TOKEN }}
236    platforms: linux/amd64,linux/arm64
237```
238
239## Deployment Summary
240
241Add a deployment summary to your workflow:
242
243```yaml
244- name: Deploy to Gordon
245  id: deploy
246  uses: bnema/gordon/.github/actions/deploy@main
247  with:
248    registry: ${{ secrets.GORDON_REGISTRY }}
249    username: ${{ secrets.GORDON_USERNAME }}
250    password: ${{ secrets.GORDON_TOKEN }}
251
252- name: Deployment Summary
253  run: |
254    echo "## Deployment Complete" >> $GITHUB_STEP_SUMMARY
255    echo "" >> $GITHUB_STEP_SUMMARY
256    echo "**Image:** \`${{ steps.deploy.outputs.image }}\`" >> $GITHUB_STEP_SUMMARY
257    echo "**Tag:** \`${{ steps.deploy.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY
258```
259
260## Troubleshooting
261
262### Authentication Failed
263
264```
265Error: unauthorized: authentication required
266```
267
268**Solution:** Verify secrets are correctly set and token has `push` scope.
269
270### Image Not Found After Push
271
272**Solution:** Ensure Gordon config has a route for the pushed image.
273
274### Build Fails
275
276**Solution:** Check Dockerfile path and build context settings.
277
278## Related
279
280- [Registry Authentication](../config/registry-auth.md)
281- [Deployment Overview](./index.md)
282- [Rollback](./rollback.md)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close