Fjerner ttl på poden slik at den ikke dør etter 3 timer #54
This file contains hidden or 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: Build and deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_deploy: | |
name: Build, push and deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v2" | |
with: | |
workload_identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: "gar-bachelor-url-forkorte-51cb@${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}.iam.gserviceaccount.com" | |
token_format: "access_token" | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: "europe-north1-docker.pkg.dev/${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}/bachelor-url-forkorter" | |
username: "oauth2accesstoken" | |
password: "${{ steps.auth.outputs.access_token }}" | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # ratchet:docker/metadata-action@v5 | |
with: | |
images: | | |
europe-north1-docker.pkg.dev/nais-management-ddba/bachelor-url-forkorter/oslomet-url-forkorter | |
tags: | | |
type=sha,prefix={{date 'YYYY.MM.DD-HH.mm'}}-,priority=9002 | |
type=raw,enable=${{ inputs.tag != '' }},value=${{ inputs.tag }},priority=9001 | |
- name: Build and push | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # ratchet:docker/build-push-action@v5 | |
id: build_push | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- run: | | |
wget https://github.com/nais/deploy/releases/download/v2/deploy-linux | |
chmod +x ./deploy-linux | |
- run: | | |
payload=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=hookd") | |
jwt=$(echo "$payload" | jq -r '.value') | |
export GITHUB_TOKEN="$jwt" | |
./deploy-linux | |
env: | |
TZ: "Europe/Oslo" | |
ACTIONS: "true" | |
CLUSTER: sandbox | |
RESOURCE: .nais/app.yaml | |
VAR: image=${{ fromJSON(steps.meta.outputs.json).tags[0] }} | |
DEPLOY_SERVER: deploy.test-nais.cloud.nais.io:443 |