Skip to content

Commit

Permalink
feat: match circleCI config
Browse files Browse the repository at this point in the history
  • Loading branch information
mansaj committed Mar 2, 2024
1 parent ad227c9 commit 8756e37
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions .github/workflows/docker_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,35 @@ jobs:
type=semver,pattern={{raw}}
type=raw,value=cicd-{{sha}},event=tag
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}

- name: Create version.json
run: |
echo "{\"commit\":\"$GITHUB_SHA\",\"version\":\"$GITHUB_REF\",\"source\":\"https://github.com/$GITHUB_REPOSITORY\",\"build\":\"$GITHUB_RUN_ID\"}" > version.json
- name: Build Docker image
run: |
docker build --tag blurts-server \
--build-arg SENTRY_RELEASE="$GITHUB_REF" \
.
- name: Deploy to Dockerhub
run: |
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
# deploy main
docker tag blurts-server ${{ env.DOCKERHUB_REPO }}:latest
docker push ${{ env.DOCKERHUB_REPO }}:latest
elif [ "${{ github.ref }}" == "refs/tags/"* ]; then
# deploy a release tag
echo "${{ env.DOCKERHUB_REPO }}:${{ github.ref }}"
docker tag blurts-server "${{ env.DOCKERHUB_REPO }}:${{ github.ref }}"
docker images
docker push "${{ env.DOCKERHUB_REPO }}:${{ github.ref }}"
fi

0 comments on commit 8756e37

Please sign in to comment.