-
Notifications
You must be signed in to change notification settings - Fork 9
78 lines (75 loc) · 2.42 KB
/
deploy.dev.yml
File metadata and controls
78 lines (75 loc) · 2.42 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
name: SRT-API DEV Deploy
on:
push:
branches:
- 'dev'
jobs:
docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
outputs:
formattedTime: ${{ steps.current-time.outputs.formattedTime }}
steps:
-
name: Get Current Time
uses: josStorer/get-current-time@v2.1.1
id: current-time
with:
format: YYYYMMDD-HHmmss
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.9.1
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/srt-api:dev-${{ steps.current-time.outputs.formattedTime }}
build-args: |
"SNYK_TOKEN=${{ secrets.SNYK_TOKEN }}"
"LOGIN_PRIVATE_KEY=${{ secrets.LOGIN_PRIVATE_DEV_KEY }}"
cloudgov:
name: Deploying to Cloud.gov
runs-on: ubuntu-latest
needs: docker
steps:
-
name: Checkout
uses: actions/checkout@v3.5.3
-
name: Install Cloud Foundry CLI
run: |
# Download CF CLI v8 directly (avoids flaky Debian repo/GitHub CDN 500s)
for i in 1 2 3; do
curl -fsSL "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=v8&source=github" -o /tmp/cf-cli.tgz && break
echo "Retry $i: CF CLI download failed, retrying in 10s..."
sleep 10
done
tar -xzf /tmp/cf-cli.tgz -C /tmp
sudo install /tmp/cf8 /usr/local/bin/cf
cf version
-
name: Cloud Foundry Login
env:
CF_API: https://api.fr.cloud.gov
CF_USERNAME: ${{ secrets.CF_USER }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
CF_ORG: gsa-ogp-srt
CF_SPACE: dev
run: cf login -a $CF_API -u $CF_USERNAME -p $CF_PASSWORD -o $CF_ORG -s $CF_SPACE
-
name: Cloud Foundry Push
env:
DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/srt-api:dev-${{ needs.docker.outputs.formattedTime }}
run: cf push srt-api-dev -f cf/manifest.dev.yml --docker-image $DOCKER_IMAGE