diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a1419ab..55be1e1 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -42,10 +42,22 @@ jobs: - name: 🚢 Push image run: ./scripts/push - - name: Install doctl - uses: digitalocean/action-doctl@v2 + - id: sha + name: Setup Environment + shell: bash + run: | + if [[ -v "GITHUB_SHA" ]]; then + GIT_SHA=${GITHUB_SHA:0:7} + else + GIT_SHA=$(git rev-parse --short=7 HEAD) + fi + echo "GIT_SHA=${GIT_SHA}" >> $GITHUB_OUTPUT + + - name: Deploy the app + uses: digitalocean/app_action/deploy@v2 + env: + IMAGE_TAG_SEROVIZ: ${{ steps.sha.outputs.GIT_SHA }} with: token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - - name: Deploy - run: doctl apps create-deployment ${{ secrets.DIGITALOCEAN_APP_ID }} --force-rebuild=true + app_name: seroviz + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' diff --git a/scripts/common b/scripts/common index d774d8a..fe0fc3d 100644 --- a/scripts/common +++ b/scripts/common @@ -20,3 +20,5 @@ fi DOCKER_COMMIT_TAG="${PACKAGE_ORG}/${PACKAGE_NAME}:${GIT_SHA}" DOCKER_BRANCH_TAG="${PACKAGE_ORG}/${PACKAGE_NAME}:${GIT_BRANCH}" + +echo $GIT_SHA \ No newline at end of file