-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55674e3
commit d44228e
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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/hibernate-jira-sync' | ||
|
||
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: 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 hibernate-jira-sync || true | ||
# https://docs.openshift.com/container-platform/4.14/openshift_images/using-imagestreams-with-kube-resources.html | ||
oc set image-lookup hibernate-jira-sync | ||
- name: Retrieve OpenShift Container Registry URL | ||
id: oc-registry | ||
run: | | ||
echo -n "OC_REGISTRY_URL=" >> "$GITHUB_OUTPUT" | ||
oc registry info >> "$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 registry info)" \ | ||
-Dquarkus.container-image.group="$(oc project --short)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters