-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (41 loc) · 1.71 KB
/
deplyment.yml
File metadata and controls
53 lines (41 loc) · 1.71 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
name: DigitalOcean App workflow
on:
push:
branches: [ main ]
env:
REGISTRY: "registry.digitalocean.com/tnews-registry"
IMAGE_NAME_AGGREGATOR: "tnews-aggregator"
IMAGE_NAME_SUBSCRIPTION: "tnews-subscription"
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: "8.11"
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build with Gradle Wrapper
run: ./gradlew build
- name: Build docker image for aggregator service
run: docker build ./aggregation-service -t $(echo $REGISTRY)/$(echo $IMAGE_NAME_AGGREGATOR):$(echo $GITHUB_SHA | head -c7)
- name: Build docker image for subscription service
run: docker build ./subscription-service -t $(echo $REGISTRY)/$(echo $IMAGE_NAME_SUBSCRIPTION):$(echo $GITHUB_SHA | head -c7)
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_TOKEN }}
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 600
- name: Push image to DigitalOcean Container Registry
run: docker push $(echo $REGISTRY)/$(echo $IMAGE_NAME_AGGREGATOR):$(echo $GITHUB_SHA | head -c7)
- name: Push image of subscription service to DigitalOcean Container Registry
run: docker push $(echo $REGISTRY)/$(echo $IMAGE_NAME_SUBSCRIPTION):$(echo $GITHUB_SHA | head -c7)