diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 723d092..5254ae3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -28,17 +28,17 @@ jobs: # # env: # IMAGE_NAME: angular-web-app -# TAG: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }} +# TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }} push: - name: ⬆️ Push Image to Gitea Registry + name: ⬆️ Build and Push Image to Gitea Registry runs-on: ubuntu-latest -# needs: build + needs: build steps: - name: Checkout Repository uses: actions/checkout@v3 - - name: Push Image + - name: Build and Push Image run: | sudo apt-get update sudo apt-get install -y docker.io bash @@ -51,7 +51,7 @@ jobs: env: IMAGE_NAME: angular-web-app - TAG: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }} + TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }} GITEA_REGISTRY: gitea.moz-tech.de deploy: @@ -67,17 +67,18 @@ jobs: - name: Deploy via SSH run: | + IMAGE_TAG="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}" echo "${{ secrets.DEPLOY_KEY }}" > /tmp/deploy_key.pem chmod 600 /tmp/deploy_key.pem ssh -i /tmp/deploy_key.pem -o StrictHostKeyChecking=no \ - ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} <<'EOF' + ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} <