Bump org.springframework.boot:spring-boot-starter-parent #70
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
name: Build, push and deploy | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
DEPLOYMENT_NAME: ${{ vars.TEAMNAME }} | |
DEPLOYMENT_TOKEN: ${{ secrets.TOKEN }} | |
NAMESPACE: ${{ vars.NAMESPACE }} | |
jobs: | |
build: | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
name: Build app | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@master | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Prepare repository name | |
run: | | |
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: Build jar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
run: | | |
mvn --batch-mode --update-snapshots clean spring-boot:build-image \ | |
-Dspring-boot.build-image.imageName=ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest | |
- name: Log in to registry | |
if: github.ref == 'refs/heads/main' | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push the Docker image to GHCR | |
if: github.ref == 'refs/heads/main' | |
run: | | |
docker push ghcr.io/${{ env.IMAGE_REPOSITORY }} | |
- name: Install Helm | |
if: github.ref == 'refs/heads/main' | |
uses: azure/setup-helm@v3 | |
with: | |
version: 'latest' # default is latest (stable) | |
token: ${{ secrets.GITHUB_TOKEN }} # only needed if version is 'latest' | |
id: install | |
- name: Deploy Helm chart | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "${{ env.DEPLOYMENT_TOKEN }}" > kubeconfig.yaml | |
helm upgrade --install \ | |
${{ env.DEPLOYMENT_NAME }} \ | |
charts/player \ | |
--set "ingress.hosts[0].host=${{ env.DEPLOYMENT_NAME }}.play.continuouspoker.org" \ | |
--set "ingress.hosts[0].paths[0].path=/" \ | |
--set "ingress.tls[0].hosts[0]=${{ env.DEPLOYMENT_NAME }}.play.continuouspoker.org" \ | |
--set "ingress.tls[0].secretName=letsencrypt-nginx-${{ env.DEPLOYMENT_NAME }}" \ | |
--set "ingress.hosts[0].paths[0].pathType=ImplementationSpecific" \ | |
--set "image.repository=ghcr.io/${{ env.IMAGE_REPOSITORY }}" \ | |
--namespace ${{ env.NAMESPACE }} \ | |
--kubeconfig kubeconfig.yaml \ | |
--force | |
rm kubeconfig.yaml |