Skip to content

fix go build on CI #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: deploy to development
permissions:
id-token: write
contents: read
on:
on:
push:
branches: [develop]
jobs:
Expand All @@ -23,12 +23,10 @@ jobs:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: install deps and build
## TODO: Move all building into the docker container
- name: install deps
run: |
go mod download
GOOS=linux GOARCH=amd64 go build -o ./cmd/app/main ./cmd/app/main.go


- name: configure aws credentials
uses: aws-actions/[email protected]
with:
Expand All @@ -39,13 +37,14 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: tag and push to Amazon ECR
- name: build,tag and push to Amazon ECR
env:
ECR_REPO: ${{ secrets.AWS_ACCT }}.dkr.ecr.us-west-2.amazonaws.com
SERVICE: string-api
IMAGE_TAG: latest
run: |
docker build -t $ECR_REPO/$SERVICE:$IMAGE_TAG ./cmd/app/
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./cmd/app/main ./cmd/app/main.go
docker build --platform linux/amd64 -t $ECR_REPO/$SERVICE:$IMAGE_TAG ./cmd/app/
docker push $ECR_REPO/$SERVICE:$IMAGE_TAG

- name: deploy
Expand All @@ -54,5 +53,4 @@ jobs:
SERVICE: string-api
AWS_REGION: us-west-2
run: |
aws ecs --region $AWS_REGION update-service --cluster $CLUSTER --service $SERVICE --force-new-deployment

aws ecs --region $AWS_REGION update-service --cluster $CLUSTER --service $SERVICE --force-new-deployment