Skip to content

Commit

Permalink
Add deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaweedbrainCY committed Jul 6, 2024
1 parent 7d39492 commit b3a477b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ on:
tags: [ '*.*' ]

env:
API_IMAGE_NAME: "api_bad_cors"
FRONTEND_IMAGE_NAME: "frontend_bad_cors"
API_SAFE_IMAGE_NAME: "safe_api_bad_cors"

DOCKER_IMAGE_NAME: "galera_healthcheck"
jobs:
build-and-publish-image:
name: Build and Publish Docker image
Expand All @@ -17,12 +14,13 @@ jobs:
- uses: actions/checkout@v3
- name: Build
working-directory: ./
run: docker build -t $API_IMAGE_NAME:latest -t $API_IMAGE_NAME:${{ github.sha }} .
run: docker build -t $DOCKER_IMAGE_NAME:latest -t $DOCKER_IMAGE_NAME:$current_version .
- name: Login to GitHub Container Registry
run: echo ${{ secrets.TOKEN }} | docker login ghcr.io -u ${{ secrets.USERNAME }} --password-stdin
- name: Push Docker image to GitHub Container Registry
run: |
docker tag $API_IMAGE_NAME:latest ghcr.io/${{ secrets.USERNAME }}/$API_IMAGE_NAME:latest
docker tag $API_IMAGE_NAME:${{ github.sha }} ghcr.io/${{ secrets.USERNAME }}/$API_IMAGE_NAME:${{ github.sha }}
docker push ghcr.io/${{ secrets.USERNAME }}/$API_IMAGE_NAME:latest
docker push ghcr.io/${{ secrets.USERNAME }}/$API_IMAGE_NAME:${{ github.sha }}
current_version=$(echo ${{ github.ref_name }} | sed 's/\([0-9]*\.[0-9]*\).*$/\1/')
docker tag $DOCKER_IMAGE_NAME:latest ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:latest
docker tag $DOCKER_IMAGE_NAME:$current_version ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:$current_version
docker push ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:latest
docker push ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:$current_version

0 comments on commit b3a477b

Please sign in to comment.