diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e2020d7..454f024 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 @@ -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 }} \ No newline at end of file + 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 \ No newline at end of file