-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (57 loc) · 1.82 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Tag and Publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Pull latest changes
run: git pull origin main
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
# relative path to the place where source code with Dockerfile is located
context: .
push: true
tags: ghcr.io/allenneuraldynamics/foraging-ephys-browser:latest
update_ecs_service :
runs-on: ubuntu-latest
needs: publish
permissions:
id-token: write
contents: read
env:
ECS_ROLE: ${{ secrets.AWS_FORAGING_ECS_ROLE }}
AWS_REGION : ${{ vars.AWS_REGION_DEV }}
ECS_CLUSTER : ${{ vars.AWS_FORAGING_ECS_CLUSTER }}
ECS_SERVICE : ${{ vars.AWS_FORAGING_ECS_SERVICE }}
steps:
- uses: actions/checkout@master
- name: Pull latest changes
run: git pull origin main
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.ECS_ROLE }}
role-session-name: github-ecs-update-service
aws-region: ${{ env.AWS_REGION }}
- name: Update ECS service
run: |
python -m pip install awscli
aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment