@@ -36,38 +36,33 @@ jobs:
3636 name : website
3737 path : ./public
3838
39- - name : Configure AWS credentials
40- uses : aws-actions/configure-aws-credentials @v1
39+ - name : Login to GitHub Container Registry
40+ uses : docker/login-action @v1
4141 with :
42- aws-access-key-id : ${{ secrets.DELPHI_ECR_ACCESS_ID }}
43- aws-secret-access-key : ${{ secrets.DELPHI_ECR_ACCESS_KEY }}
44- aws-region : us-east-1
42+ registry : ghcr.io
43+ username : cmu-delphi-deploy-machine
44+ password : ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}
4545
46- - name : Login to Amazon ECR
47- id : login-ecr
48- uses : aws-actions/amazon-ecr-login@v1
49-
50- - name : Build, tag, and push image to Amazon ECR
46+ - name : Build, tag, and push image to Github
5147 env :
52- ECR_REGISTRY : ${{ steps.login-ecr.outputs.registry }}
53- ECR_REPOSITORY : ${{ github.event.repository.name }}
48+ DEVOPS_DOCKER_FILE : ./devops/precompiled.dockerfile
5449 run : |
5550 baseRef="${GITHUB_REF#*/}"
5651 baseRef="${baseRef#*/}"
5752 case "${baseRef}" in
5853 main)
59- awsTag ="latest"
54+ imageTag ="latest"
6055 ;;
6156 *)
62- awsTag ="${baseRef//\//_}" # replace `/` with `_` in branch name
57+ imageTag ="${baseRef//\//_}" # replace `/` with `_` in branch name
6358 ;;
6459 esac
65- echo "using tag: --${awsTag }--"
66- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$awsTag --file ./devops/precompiled/Dockerfile .
67- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$awsTag
60+ echo "using tag: --${imageTag }--"
61+ docker build -t ghcr.io/${{ github.repository }}:$imageTag --file ${DEVOPS_DOCKER_FILE} .
62+ docker push ghcr.io/${{ github.repository }}:$imageTag
6863
6964 # trigger a webhook update
7065 curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
7166 -X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
7267 -H "Content-Type: application/x-www-form-urlencoded" \
73- -d "repository=$ECR_REGISTRY/$ECR_REPOSITORY &tag=$awsTag "
68+ -d "repository=ghcr.io/${{ github.repository }} &tag=$imageTag "
0 commit comments