Skip to content

Commit cf0203e

Browse files
Add production / development workflows to push to docker registry.
1 parent 91239cb commit cf0203e

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

.github/workflows/development.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Development Build
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
env:
12+
CONTAINER_NAME: nvdaremote-staging
13+
WEBHOOK_URL: https://webhook-internal.nvaccess.org/hooks/deploy
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set Version
22+
id: version
23+
run: echo "version=dev-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ github.token }}
34+
35+
- name: Build and Push Container
36+
uses: docker/build-push-action@v5
37+
with:
38+
context: .
39+
push: true
40+
build-args: |
41+
GITHUB_BRANCH=dev
42+
GITHUB_SHA=${{ github.sha }}
43+
tags: |
44+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
45+
ghcr.io/${{ github.repository }}:latest-staging
46+
47+
- name: Trigger Deployment Webhook
48+
run: |
49+
curl -X POST ${{ env.WEBHOOK_URL }} \
50+
-H "Content-Type: application/json" \
51+
-d '{"container": "${{ env.CONTAINER_NAME }}", "secret": "${{ secrets.DOCKER_WEBHOOK_SECRET }}"}'
52+

.github/workflows/production.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Production Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
env:
12+
CONTAINER_NAME: nvdaremote-production
13+
WEBHOOK_URL: https://webhook-internal.nvaccess.org/hooks/deploy
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set Version
22+
id: version
23+
run: echo "version=main-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ github.token }}
34+
35+
- name: Build and Push Container
36+
uses: docker/build-push-action@v5
37+
with:
38+
context: .
39+
push: true
40+
build-args: |
41+
GITHUB_BRANCH=main
42+
GITHUB_SHA=${{ github.sha }}
43+
tags: |
44+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
45+
ghcr.io/${{ github.repository }}:latest-production
46+
47+
- name: Trigger Deployment Webhook
48+
run: |
49+
curl -X POST ${{ env.WEBHOOK_URL }} \
50+
-H "Content-Type: application/json" \
51+
-d '{"container": "${{ env.CONTAINER_NAME }}", "secret": "${{ secrets.DOCKER_WEBHOOK_SECRET }}"}'
52+

0 commit comments

Comments
 (0)