Deploy til preprod #290
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: Deploy til preprod | |
on: [workflow_dispatch] | |
env: | |
BASE_IMAGE: ghcr.io/${{ github.repository }} | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: temurin | |
cache: gradle | |
- name: Kjør tester & bygg JAR | |
run: ./gradlew test shadowjar | |
env: | |
GITHUB_TOKEN: ${{ secrets.READER_TOKEN }} | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.REPOSITORY_OWNER }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sett tag for docker image | |
run: echo "TAG=$(date "+%Y.%m.%d")-$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Bygg & last opp Docker image | |
run: | | |
docker build --pull --tag ${BASE_IMAGE}:${TAG} --tag ${BASE_IMAGE}:latest . | |
docker push ${BASE_IMAGE} --all-tags | |
- name: Sett image for nais deploy | |
run: echo "IMAGE=${BASE_IMAGE}:${TAG}" >> $GITHUB_ENV | |
- name: Deploy til preprod | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.DEPLOY_KEY }} | |
CLUSTER: dev-fss | |
RESOURCE: nais/dev-fss.yml |