Manual deploy dev #66
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: Manual deploy dev | |
on: | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
checks: write | |
id-token: write | |
packages: write | |
steps: | |
# Checkout | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'gradle' | |
# Build | |
- name: Change wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Build | |
run: ./gradlew build | |
env: | |
GITHUB_TOKEN: ${{ secrets.READER_TOKEN }} | |
# Release | |
- name: Create Docker tag | |
env: | |
NAME: tjenestepensjon-simulering | |
run: | | |
echo "ghcr.io"/"$GITHUB_REPOSITORY"/"$NAME" > .docker_image | |
echo "$(date "+%Y.%m.%d")-$(git rev-parse --short HEAD)" > .docker_tag | |
- name: Build Docker image | |
run: | | |
docker build -t $(cat .docker_image):$(cat .docker_tag) . | |
- name: Login to Github Container Registry | |
env: | |
DOCKER_USERNAME: x-access-token | |
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin ghcr.io | |
echo "IMAGE=$(cat .docker_image):$(cat .docker_tag)" >> $GITHUB_ENV | |
- name: Push Docker image | |
run: "docker push $(cat .docker_image):$(cat .docker_tag)" | |
# Deploy dev-fss | |
- name: Deploy tjenestepensjon-simulering to dev-fss | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-fss | |
RESOURCE: .nais/nais-dev.yaml | |
IMAGE: ${{ env.IMAGE }} | |
TEAM: pensjonskalkulator | |