Validate tokens #122
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: Bygg og deploy omsorgsopptjening-start-innlesning til dev-gcp | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tag_build_and_deploy: | |
name: 'Build, deploy and tag' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# PULLER REPO | |
- name: 'Pull repo' | |
uses: actions/checkout@v1 | |
# SETTER DATO OG COMMIT VARIABEL | |
- name: 'Setter dato og commit variabel' | |
run: | | |
export TZ=CET | |
echo "DATE=$(date "+%Y-%m-%d--%H-%M-%S")" >> $GITHUB_ENV | |
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
# SETTER IMAGE VARIABEL | |
- name: 'Setting Image Variabel' | |
run: echo "IMAGE=docker.pkg.github.com/${{ github.repository }}/omsorgsopptjening-start-innlesning:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV | |
# SETTER IMAGE GHCR VARIABEL | |
- name: 'Setting Image ghcr Variabel' | |
run: echo "IMAGE_GHCR=ghcr.io/${{ github.repository }}/omsorgsopptjening-start-innlesning:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV | |
# JAVA 17 | |
- name: 'Java 17' | |
uses: actions/[email protected] | |
with: | |
java-version: 17 | |
cache: 'gradle' | |
# BYGGER DOCKER CONTAINER | |
- name: 'Bygg og publiser docker image' | |
run: | | |
./gradlew build | |
docker build --tag ${{ env.IMAGE }} . | |
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${{ secrets.GITHUB_TOKEN }} | |
docker push ${{ env.IMAGE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# DEPLOYER dev-gcp | |
- name: 'Deploy omsorgsopptjening-start-innlesning to dev-gcp' | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
RESOURCE: nais/dev-gcp.yml | |
CLUSTER: dev-gcp | |
IMAGE: ${{ env.IMAGE_GHCR }} |