legger inn åpent NAV-mirror for github-pakker #69
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: Spleis-opprydding-dev | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'Dockerfile-opprydding-dev' | |
- 'sykepenger-opprydding-dev/**' | |
- 'build.gradle.kts' | |
- '.github/workflows/spleis-opprydding-dev.yml' | |
- 'deploy/dev-opprydding.yml' | |
env: | |
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
set_version: | |
name: set image name | |
runs-on: ubuntu-latest | |
steps: | |
- name: create docker tag | |
run: echo "TAG=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
outputs: | |
image: ghcr.io/${{ github.repository }}/spleis-opprydding-dev:${{ env.TAG }} | |
build: | |
name: build docker image | |
runs-on: ubuntu-latest | |
needs: set_version | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21.x' | |
cache: 'gradle' | |
- name: test and build | |
run: ./gradlew :sykepenger-opprydding-dev:test :sykepenger-opprydding-dev:build | |
- name: build docker image | |
run: docker build -f Dockerfile sykepenger-opprydding-dev --pull -t ${{ needs.set_version.outputs.image }} | |
- name: push docker image | |
run: | | |
docker login ghcr.io --username "$GITHUB_REPOSITORY" -p ${{ secrets.GITHUB_TOKEN }} | |
docker push ${{ needs.set_version.outputs.image }} | |
deployDev: | |
name: deploy to dev | |
needs: [set_version, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: deploy/dev-opprydding.yml | |
IMAGE: ${{ needs.set_version.outputs.image }} |