Flytter kode for prosesseringssteg til fellesmodul #93
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 and deploy ebms-provider" | |
on: | |
push: | |
branches: | |
- main | |
- dev/** | |
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 }}/payload-processor:${{ 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": "17" | |
"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" | |
run: "docker build ebms-provider --pull --tag ${IMAGE_EBMS} -f Dockerfile && docker push ${IMAGE_EBMS}" | |
- name: "Build and push cpa-repo Docker image" | |
run: "docker build cpa-repo --pull --tag ${IMAGE_CPA} -f Dockerfile && docker push ${IMAGE_CPA}" | |
- name: "Build and push payload-processor Docker image" | |
run: "docker build payload-processor --pull --tag ${IMAGE_PAYLOAD} -f Dockerfile && docker push ${IMAGE_PAYLOAD}" | |
deploy-processor: | |
name: "Deploy ebms provider to dev" | |
needs: "build" | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Deploy to DEV" | |
uses: "nais/deploy/actions/deploy@v1" | |
env: | |
APIKEY: "${{ secrets.NAIS_DEPLOY_APIKEY }}" | |
CLUSTER: "dev-gcp" | |
RESOURCE: ".nais/ebms-provider-dev.yaml" | |
IMAGE: ${{env.IMAGE_EBMS}} | |
deploy-cpa-repo: | |
name: "Deploy cpa-repo to dev" | |
needs: "build" | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Deploy to DEV" | |
uses: "nais/deploy/actions/deploy@v1" | |
env: | |
APIKEY: "${{ secrets.NAIS_DEPLOY_APIKEY }}" | |
CLUSTER: "dev-gcp" | |
RESOURCE: ".nais/cpa-repo-dev.yaml" | |
IMAGE: ${{env.IMAGE_CPA}} | |
deploy-payload-processor: | |
name: "Deploy payload-processor to dev" | |
needs: "build" | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Deploy to DEV" | |
uses: "nais/deploy/actions/deploy@v1" | |
env: | |
APIKEY: "${{ secrets.NAIS_DEPLOY_APIKEY }}" | |
CLUSTER: "dev-gcp" | |
RESOURCE: ".nais/payload-processor-dev.yaml" | |
IMAGE: ${{env.IMAGE_PAYLOAD}} |