Skip to content

Commit

Permalink
ci: also deploy backend through deploy-feature-branch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrele committed Mar 18, 2022
1 parent 6cfd1c2 commit bf7a546
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/deploy-feature-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,61 @@ env:
TZ: Europe/Amsterdam

jobs:
build-docker-image-backend:
name: Build Docker image (backend)
runs-on: ubuntu-latest
needs: change-check
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
cache: gradle
- name: Set up test environment
run: docker-compose up -d
- name: Build with Gradle
run: ./gradlew build
- name: Build and push Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} --password-stdin
echo ${GITHUB_TOKEN} | docker login ghcr.io -u ${{github.actor}} --password-stdin
docker build -t ${IMAGE}/mulighetsrommet-api-${IMAGE_LABEL_DEV}:${IMAGE_TAG} .
docker push ${IMAGE}/mulighetsrommet-api-${IMAGE_LABEL_DEV}:${IMAGE_TAG}
deploy-backend:
name: Deploy Docker image (backend)
runs-on: ubuntu-latest
needs: build-docker-image-backend
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Deploy
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: backend/.nais/nais.yaml
VAR: image_tag=${{env.IMAGE_TAG}},image_label=${{env.IMAGE_LABEL_DEV}}
- name: Create release tag
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release/dev@${{ env.IMAGE_TAG }}
release_name: Release to dev
prerelease: true

build-docker-image-frontend-dev:
name: Build Docker image (dev)
runs-on: ubuntu-latest
Expand Down

0 comments on commit bf7a546

Please sign in to comment.