Skip to content

bumper versjoner

bumper versjoner #267

Workflow file for this run

name: master
on:
push:
branches:
- master
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 }}/spanner:${{ 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: '17.x'
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: test and build
run: ./gradlew build
- name: build docker image
run: docker build . --pull -t ${{ needs.set_version.outputs.image }}
- name: push docker image
run: |
docker login --username "$GITHUB_REPOSITORY" -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
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.yml
IMAGE: ${{ needs.set_version.outputs.image }}
deployProd:
name: Deploy to prod
needs: [ set_version, deployDev ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: deploy/prod.yml
IMAGE: ${{ needs.set_version.outputs.image }}