PROD: Build and deploy til ebms til PROD #67
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: "PROD: Build and deploy til ebms til PROD" | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
env: | |
"IMAGE_EBMS": "ghcr.io/${{ github.repository }}/ebms-provider:${{ github.sha }}" | |
"IMAGE_CPA": "ghcr.io/${{ github.repository }}/cpa-repo:${{ github.sha }}" | |
"IMAGE_PAYLOAD": "ghcr.io/${{ github.repository }}/ebms-payload:${{ github.sha }}" | |
jobs: | |
build: | |
name: "build" | |
runs-on: "ubuntu-20.04" | |
permissions: | |
packages: write | |
repository-projects: write | |
contents: write | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-java@v3" | |
with: | |
"java-version": "21" | |
"distribution": "temurin" | |
- name: Cache gradle wrapper | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('build.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-cache- | |
- name: "Build and tests" | |
run: ./gradlew test build | |
env: | |
ORG_GRADLE_PROJECT_githubUser: x-access-token | |
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to GitHub Packages Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Build and push ebms-provider Docker image" | |
id: "docker-build-push-ebms-provider" | |
run: "docker build ebms-provider --pull --tag ${IMAGE_EBMS} -f Dockerfile && docker push ${IMAGE_EBMS}" | |
- name: "Build and push cpa-repo Docker image" | |
id: "docker-build-push-cpa-repo" | |
run: "docker build cpa-repo --pull --tag ${IMAGE_CPA} -f Dockerfile && docker push ${IMAGE_CPA}" | |
- name: "Build and push ebms-payload Docker image" | |
id: "docker-build-push-ebms-payload" | |
run: "docker build ebms-payload --pull --tag ${IMAGE_PAYLOAD} -f Dockerfile && docker push ${IMAGE_PAYLOAD}" | |
deploy-processor: | |
name: "Deploy ebms provider to PROD" | |
needs: "build" | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Deploy to PROD" | |
uses: "nais/deploy/actions/deploy@v1" | |
env: | |
APIKEY: "${{ secrets.NAIS_DEPLOY_APIKEY }}" | |
CLUSTER: "prod-fss" | |
RESOURCE: ".nais/ebms-provider-prod.yaml" | |
IMAGE: ${{env.IMAGE_EBMS}} | |
TELEMETRY: ${{ steps.docker-build-push-ebms-provider.outputs.telemetry }} | |
deploy-cpa-repo: | |
name: "Deploy cpa-repo to prod" | |
needs: "build" | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Deploy to PROD" | |
uses: "nais/deploy/actions/deploy@v1" | |
env: | |
APIKEY: "${{ secrets.NAIS_DEPLOY_APIKEY }}" | |
CLUSTER: "prod-fss" | |
RESOURCE: ".nais/cpa-repo-prod.yaml" | |
IMAGE: ${{env.IMAGE_CPA}} | |
TELEMETRY: ${{ steps.docker-build-push-cpa-repo.outputs.telemetry }} | |
deploy-ebms-payload: | |
name: "Deploy ebms-payload to prod" | |
needs: "build" | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Deploy to PROD" | |
uses: "nais/deploy/actions/deploy@v1" | |
env: | |
APIKEY: "${{ secrets.NAIS_DEPLOY_APIKEY }}" | |
CLUSTER: "prod-fss" | |
RESOURCE: ".nais/ebms-payload-prod.yaml" | |
IMAGE: ${{env.IMAGE_PAYLOAD}} | |
TELEMETRY: ${{ steps.docker-build-push-ebms-payload.outputs.telemetry }} |