-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from navikt/gar
Gar
- Loading branch information
Showing
3 changed files
with
32 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,37 @@ | ||
name: Build and deploy | ||
name: Build, push, and deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
build-push: | ||
name: Build and push image | ||
build: | ||
name: Build and push Docker container | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
outputs: | ||
image: ${{ steps.docker-build-push.outputs.image }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY}:$(git log -1 --pretty=%ad --date=format:%Y-%m-%d)-$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV | ||
- run: docker build -t $IMAGE . | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ${{ env.IMAGE }} | ||
context: . | ||
- uses: actions/checkout@v4 | ||
- name: Push docker image to GAR | ||
uses: nais/docker-build-push@v0 | ||
id: docker-build-push | ||
with: | ||
team: the-g-team | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} # Provided as Organization Secret | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} # Provided as Organization Variable | ||
|
||
nais-yaml: | ||
name: Release to nais-yaml | ||
deploy: | ||
name: Deploy to NAIS | ||
needs: build | ||
runs-on: ubuntu-latest | ||
needs: build-push | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: echo "TAG=$(git log -1 --pretty=%ad --date=format:%Y-%m-%d)-$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV | ||
- name: deploy to prod | ||
uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: prod-gcp | ||
RESOURCE: nais/nais.yaml,nais/alert.yaml | ||
VAR: TAG=${{ env.TAG }} | ||
- uses: actions/checkout@v4 | ||
- uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: prod-gcp | ||
RESOURCE: nais/nais.yaml,nais/alert.yaml | ||
VAR: image=${{ needs.build.outputs.image }} |
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
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