-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (74 loc) · 3.11 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
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
name: Deploy
on:
push:
branches:
- "production"
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'
concurrency:
group: deployment
cancel-in-progress: false
jobs:
deploy:
if: github.repository == 'hibernate/replicate-jira'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 21
- name: Set up Helm
uses: azure/[email protected]
with:
version: 'v3.13.3'
- name: Log in to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_INFRA_PROD }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN_INFRA_PROD }}
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_INFRA_PROD }}
- name: Create ImageStream
run: |
oc create imagestream replicate-jira || true
# https://docs.openshift.com/container-platform/4.14/openshift_images/using-imagestreams-with-kube-resources.html
oc set image-lookup replicate-jira
- name: Retrieve OpenShift Container Registry URL
id: oc-registry
run: |
echo -n "OC_REGISTRY_URL=" >> "$GITHUB_OUTPUT"
oc get imagestream -o json | jq -r '.items[0].status.publicDockerImageRepository' | awk -F"[/]" '{print $1}' >> "$GITHUB_OUTPUT"
- name: Log in to OpenShift Container Registry
uses: docker/login-action@v3
with:
registry: ${{ steps.oc-registry.outputs.OC_REGISTRY_URL }}
username: ignored
password: ${{ secrets.OPENSHIFT_TOKEN_INFRA_PROD }}
# Helm in particular needs semantic versions
# See https://github.com/helm/helm/issues/9342#issuecomment-775269042
# See the parts about pre-release versions in https://semver.org/#semantic-versioning-specification-semver
# Ideally we should use a "+" before the SHA, but that won't work with Quarkus
# See https://github.com/quarkusio/quarkus/blob/da1a782e04b01b2e165d65474163050d497340c1/extensions/container-image/spi/src/main/java/io/quarkus/container/spi/ImageReference.java#L60
- name: Generate app version
id: app-version
run: |
echo "VALUE=1.0.0-$(date -u '+%Y%m%d%H%M%S')-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Build and push app container image
run: |
./mvnw clean package \
-Drevision="${{ steps.app-version.outputs.value }}" \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.registry="$(oc get imagestream -o json | jq -r '.items[0].status.publicDockerImageRepository' | awk -F"[/]" '{print $1}')" \
-Dquarkus.container-image.group="$(oc project --short)" \
-Dquarkus.container-image.additional-tags=latest
- name: Deploy Helm charts
run: |
helm upgrade --install replicate-jira ./target/helm/openshift/replicate-jira