-
-
Notifications
You must be signed in to change notification settings - Fork 30
51 lines (44 loc) · 1.45 KB
/
deploy.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
name: Deploy
on:
workflow_call:
inputs:
version:
description: Version to deploy
required: true
type: string
env:
HEROKU_REGISTRY_TOKEN: ${{ secrets.HEROKU_REGISTRY_TOKEN }}
JAVA_DISTRIBUTION: zulu
JAVA_VERSION: 21
jobs:
deploy-web:
runs-on: [ ubuntu-latest ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: Setup Java
uses: actions/setup-java@v4
with:
cache: gradle
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Login to Heroku Container Registry
uses: docker/login-action@v3
with:
password: ${{ env.HEROKU_REGISTRY_TOKEN }}
registry: registry.heroku.com
username: _
- name: Push image to Heroku registry
run: ./gradlew :chucknorris-web:dockerPushHerokuProduction
- name: Trigger release
shell: bash
run: |
export IMAGE_ID=$(docker inspect registry.heroku.com/chucky/web --format={{.Id}})
curl -X PATCH \
https://api.heroku.com/apps/chucky/formation \
-H 'Accept: application/vnd.heroku+json; version=3.docker-releases' \
-H "Authorization: Bearer ${HEROKU_REGISTRY_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{\"updates\":[{\"type\":\"web\",\"docker_image\":\"${IMAGE_ID}\"}]}"