-
Notifications
You must be signed in to change notification settings - Fork 7
86 lines (75 loc) · 2.42 KB
/
api-version.yaml
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
name: "API - Version"
on:
push:
paths:
- "sourcecode/apis/version/**"
- ".github/workflows/api-version.yaml"
workflow_call:
inputs:
versionToRelease:
description: 'A version to release'
required: true
type: string
secrets:
AWS_DOCKER_REGISTRY_ACCESS_KEY_ID:
required: true
AWS_DOCKER_REGISTRY_SECRET_ACCESS_KEY:
required: true
env:
workingDirectory: sourcecode/apis/version
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: cd ${{ env.workingDirectory }}; mvn --batch-mode --update-snapshots verify
create_release:
runs-on: ubuntu-latest
needs: test
if: ${{ inputs.versionToRelease }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_DOCKER_REGISTRY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DOCKER_REGISTRY_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-duration-seconds: 3600
role-session-name: GithubCerpusPushImage
- name: Login to AWS docker registry
shell: bash
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push app
id: docker_build_app
uses: docker/build-push-action@v4
with:
push: true
tags: public.ecr.aws/f0t8l9h1/api-version-app:${{ inputs.versionToRelease }}
context: sourcecode/apis/version
target: app-prod
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push migration container
id: docker_build_migration
uses: docker/build-push-action@v4
with:
push: true
tags: public.ecr.aws/f0t8l9h1/api-version-migration:${{ inputs.versionToRelease }}
context: sourcecode/apis/version
target: deploy
cache-from: type=gha
cache-to: type=gha,mode=max