1111 types :
1212 - published
1313
14- env :
15- PROJECT_NAME : express-graphql-example
16- ORGANIZATION : juffalow
17-
1814jobs :
1915 lint :
2016 name : Lint
@@ -74,46 +70,29 @@ jobs:
7470 run : |
7571 yarn test
7672 CODECOV_TOKEN="$TOKEN" bash <(curl -s https://codecov.io/bash)
77- push_version :
78- needs : test
79- name : Push container
80- runs-on : ubuntu-latest
73+ build :
74+ name : Build container with tag version
8175 if : github.event_name == 'release'
82- steps :
83- - uses : actions/checkout@v2
84- - name : Build
85- run : docker build -t $ORGANIZATION/$PROJECT_NAME .
86- - name : Install doctl
87- uses : digitalocean/action-doctl@v2
88- with :
89- token : ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
90- - name : Push image to Digital Ocean Container Registry
91- run : |
92- VERSION=${GITHUB_REF#"refs/tags/"}
93-
94- docker tag $ORGANIZATION/$PROJECT_NAME registry.digitalocean.com/$ORGANIZATION/$PROJECT_NAME:$VERSION
95-
96- doctl auth init
97- doctl registry login
98-
99- docker push registry.digitalocean.com/$ORGANIZATION/$PROJECT_NAME:$VERSION
100- deploy_prod :
101- needs : push_version
102- name : Deploy to prod
10376 runs-on : ubuntu-latest
104- if : github.event_name == 'release'
77+ needs : test
10578 steps :
10679 - uses : actions/checkout@v2
107- - name : Install doctl
108- uses : digitalocean/action-doctl@v2
10980 with :
110- token : ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
111- - name : Obtain kubernetes config
81+ fetch-depth : 1
82+ - name : Configure AWS credentials
83+ uses : aws-actions/configure-aws-credentials@v1
84+ with :
85+ aws-access-key-id : ${{ secrets.AWS_ZDIELAJ_SI_ACCESS_KEY_ID }}
86+ aws-secret-access-key : ${{ secrets.AWS_ZDIELAJ_SI_SECRET_ACCESS_KEY }}
87+ aws-region : ${{ secrets.AWS_CONTAINER_REGISTRY_REGION }}
88+ - name : Login to Amazon ECR
89+ id : login-ecr
90+ uses : aws-actions/amazon-ecr-login@v1
91+ - name : Build, tag and push docker image to Amazon ECR
11292 env :
113- cluster : ${{ secrets.DIGITALOCEAN_KUBERNETES_PRODUCTION }}
114- run : doctl kubernetes cluster kubeconfig save $cluster
115- - name : Deploy new version
93+ REGISTRY : ${{ steps.login-ecr.outputs.registry }}
94+ REPOSITORY : express-graphql-example
95+ TAG : ${GITHUB_REF#"refs/tags/"}
11696 run : |
117- VERSION=${GITHUB_REF#"refs/tags/"}
118-
119- kubectl set image deployment/$PROJECT_NAME-deployment $PROJECT_NAME-application=registry.digitalocean.com/$ORGANIZATION/$PROJECT_NAME:$VERSION
97+ docker build -t $REGISTRY/$REPOSITORY:$TAG .
98+ docker push $REGISTRY/$REPOSITORY:$TAG
0 commit comments