Skip to content

Commit

Permalink
Deploy services
Browse files Browse the repository at this point in the history
  • Loading branch information
ilja-git committed Nov 21, 2023
1 parent 59306f4 commit 0b79474
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ jobs:
compose/tests-all.log
retention-days: 2

tag:
if: ${{ github.ref == 'refs/heads/master' }}
deploy:
#if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs:
- test
- dockerize
#needs:
# - test
# - dockerize
strategy:
fail-fast: false
matrix:
Expand All @@ -188,10 +188,31 @@ jobs:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
role-duration-seconds: 1200
role-session-name: "ci-shared"

- name: Retag
if: false # TODO
run: |
for repository in service api-gateway frontend; do
MANIFEST=$(aws ecr batch-get-image --repository-name "oppivelvollisuus/$repository" --image-ids imageTag="${{ github.event.pull_request.head.sha || github.sha }}" --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name "oppivelvollisuus/$repository" --image-tag "env-${{ matrix.environment }}" --image-manifest "$MANIFEST"
done
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: voltti-ci-oppivelvollisuus-${{ matrix.environment }}
role-duration-seconds: 1200
role-session-name: "ci-${{ matrix.environment }}"
unset-current-credentials: true

- name: Deploy
run: |
aws ecs update-service \
--cluster "oppivelvollisuus-${{ matrix.environment }}" \
--service "oppivelvollisuus-${{ matrix.environment }}" \
--force-new-deployment
aws ecs wait services-stable \
--cluster "oppivelvollisuus-${{ matrix.environment }}" \
--services "oppivelvollisuus-${{ matrix.environment }}"
3 changes: 3 additions & 0 deletions api-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ FROM builder

ENV NODE_ENV production

RUN apt-get update \
&& apt-get -y install curl

ARG build=none
ARG commit=none

Expand Down

0 comments on commit 0b79474

Please sign in to comment.