Merge pull request #105 from gdisdevops/docker-test #225
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: Java CI | |
on: [push] | |
jobs: | |
test: | |
name: "Test" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
kubernetes_version: | |
- "kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144" | |
- "kindest/node:v1.28.6@sha256:b7e1cf6b2b729f604133c667a6be8aab6f4dde5bb042c1891ae248d9154f665b" | |
- "kindest/node:v1.27.10@sha256:3700c811144e24a6c6181065265f69b9bf0b437c45741017182d7c82b908918f" | |
- "kindest/node:v1.26.13@sha256:15ae92d507b7d4aec6e8920d358fc63d3b980493db191d7327541fbaaed1f789" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
cache: 'maven' | |
- uses: helm/[email protected] | |
with: | |
version: "v0.17.0" | |
node_image: "${{ matrix.kubernetes_version }}" | |
- name: "Kubernetes version" | |
run: | | |
kubectl version | |
- name: "Create Custom Resource" | |
run: | | |
kubectl apply -f crd.yml | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml -Dspring.profiles.active=test | |
docker-push: | |
name: Docker Push (GHCR & public ECR) | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/docker-') | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Set output | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Docker publish | |
uses: daspawnw/docker-multi-build-push-action@master | |
with: | |
platforms: "linux/amd64,linux/arm64" | |
docker-tag: "${{ steps.vars.outputs.tag }}" | |
ghcr-enabled: "true" | |
ghcr-token: "${{ secrets.GITHUB_TOKEN }}" | |
ecr-enabled: ${{ github.repository == 'daspawnw/vault-crd' }} | |
ecr-role-to-assume: "${{ secrets.AWS_PUBLIC_ECR_ARN }}" | |
ecr-repository-url: "public.ecr.aws/l2l6k4u5/vault-crd" |