This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
forked from XGovFormBuilder/digital-form-builder
-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (105 loc) · 3.86 KB
/
build-and-push.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
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
118
119
120
121
name: Deploy runner and designer
on:
push:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
build-runner:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
DOCKER_IMAGE: alphagov/digital-form-builder/runner
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set environment variables
run: |
echo "DOCKER_IMAGE_TAG=${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE }}:$GITHUB_SHA" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_TAG }}
push: true
file: runner/Dockerfile
build-args: |
COMMIT_SHA=$GITHUB_SHA
- name: Install cloudfoundary
shell: bash
id: install-cf-cli
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf8-cli
- name: Deploy to Gov.uk PaaS
id: deploy-to-paas
shell: bash
run: |
cf api ${{ secrets.CF_API }}
cf auth "${{ secrets.CF_USER }}" "${{ secrets.CF_PASSWORD }}"
cf target -o ${{ secrets.CF_ORGANISATION }} -s ${{ secrets.CF_SPACE }}
CF_DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }} cf push -f ./runner/manifest.yml \
--docker-image ${{ env.DOCKER_IMAGE_TAG }} \
--docker-username ${{ github.actor }}
build-designer:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
DOCKER_IMAGE: alphagov/digital-form-builder/designer
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set environment variables
run: |
echo "DOCKER_IMAGE_TAG=${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE }}:$GITHUB_SHA" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_TAG }}
push: true
file: designer/Dockerfile
build-args: |
COMMIT_SHA=$GITHUB_SHA
- name: Install cloudfoundary
shell: bash
id: install-cf-cli
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf8-cli
- name: Deploy to Gov.uk PaaS
id: deploy-to-paas
shell: bash
run: |
cf api ${{ secrets.CF_API }}
cf auth "${{ secrets.CF_USER }}" "${{ secrets.CF_PASSWORD }}"
cf target -o ${{ secrets.CF_ORGANISATION }} -s ${{ secrets.CF_SPACE }}
CF_DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }} cf push -f ./designer/manifest.yml \
--docker-image ${{ env.DOCKER_IMAGE_TAG }} \
--docker-username ${{ github.actor }} \
--var FORMS_API_URL=${{ secrets.FORMS_API_URL }} \
--var PUBLISH_URL=${{ secrets.PUBLISH_URL }} \
--var PREVIEW_URL=${{ secrets.PREVIEW_URL }}