This commit is contained in:
Murat Özkorkmaz
2025-10-17 17:49:57 +02:00
parent e6b769f547
commit a1a499f877

View File

@@ -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,16 +67,17 @@ 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 }} <<EOF
docker login gitea.moz-tech.de -u "${{ secrets.CI_REGISTRY_USER }}" -p "${{ secrets.CI_REGISTRY_PASSWORD }}"
docker pull gitea.moz-tech.de/${{ secrets.CI_REGISTRY_USER }}/angular-web-app:latest
docker pull gitea.moz-tech.de/${{ secrets.CI_REGISTRY_USER }}/angular-web-app:${IMAGE_TAG}
docker stop angular-web-app || true
docker rm angular-web-app || true
docker run -d --name angular-web-app -p 80:80 gitea.moz-tech.de/${{ secrets.CI_REGISTRY_USER }}/angular-web-app:latest
docker run -d --name angular-web-app -p 80:80 gitea.moz-tech.de/${{ secrets.CI_REGISTRY_USER }}/angular-web-app:${IMAGE_TAG}
EOF
# notify: