Skip to content

Commit 2e5fe43

Browse files
authored
STR-429 (#109)
* CI/CD * test deployment * updated configured creds version * revert changes for testing deployment
1 parent d31cdd2 commit 2e5fe43

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

.github/workflows/dev-deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: deploy to development
2+
permissions:
3+
id-token: write
4+
contents: read
5+
on:
6+
push:
7+
branches: [develop]
8+
jobs:
9+
deploy:
10+
environment:
11+
name: development
12+
url: https://string-api.dev.string-api.xyz
13+
14+
name: build push and deploy
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
20+
- name: setup go
21+
uses: actions/setup-go@v3
22+
with:
23+
go-version-file: go.mod
24+
cache: true
25+
cache-dependency-path: go.sum
26+
- name: install deps and build
27+
## TODO: Move all building into the docker container
28+
run: |
29+
go mod download
30+
GOOS=linux GOARCH=amd64 go build -o ./cmd/app/main ./cmd/app/main.go
31+
32+
- name: configure aws credentials
33+
uses: aws-actions/[email protected]
34+
with:
35+
aws-region: us-west-2
36+
role-to-assume: ${{ secrets.ASSUME_ROLE }}
37+
38+
- name: login to Amazon ECR
39+
id: login-ecr
40+
uses: aws-actions/amazon-ecr-login@v1
41+
42+
- name: tag and push to Amazon ECR
43+
env:
44+
ECR_REPO: ${{ secrets.AWS_ACCT }}.dkr.ecr.us-west-2.amazonaws.com
45+
SERVICE: string-api
46+
IMAGE_TAG: latest
47+
run: |
48+
docker build -t $ECR_REPO/$SERVICE:$IMAGE_TAG ./cmd/app/
49+
docker push $ECR_REPO/$SERVICE:$IMAGE_TAG
50+
51+
- name: deploy
52+
env:
53+
CLUSTER: string-core
54+
SERVICE: string-api
55+
AWS_REGION: us-west-2
56+
run: |
57+
aws ecs --region $AWS_REGION update-service --cluster $CLUSTER --service $SERVICE --force-new-deployment
58+

.github/workflows/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ on:
22
pull_request:
33
branches:
44
- develop
5-
65
name: run tests
76
jobs:
87
lint:
@@ -17,7 +16,7 @@ jobs:
1716
cache: true
1817
cache-dependency-path: go.sum
1918
- name: Install golangci-lint
20-
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3
19+
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
2120
- name: Run golangci-lint
2221
run: golangci-lint run --version --verbose --out-format=github-actions
2322

@@ -56,5 +55,5 @@ jobs:
5655
- name: Coveralls
5756
uses: coverallsapp/[email protected]
5857
with:
59-
github-token: ${{ secrets.github_token }}
60-
path-to-lcov: coverage.lcov
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
path-to-lcov: coverage.lcov

0 commit comments

Comments
 (0)