Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/build-and-deploy-prod.yml | 13 | ||||
| -rw-r--r-- | .github/workflows/build-and-deploy-stage.yml | 17 |
2 files changed, 16 insertions, 14 deletions
diff --git a/.github/workflows/build-and-deploy-prod.yml b/.github/workflows/build-and-deploy-prod.yml index 060ae32..ded8c93 100644 --- a/.github/workflows/build-and-deploy-prod.yml +++ b/.github/workflows/build-and-deploy-prod.yml @@ -40,8 +40,6 @@ jobs: context: . file: ./Dockerfile push: true - cache-from: type=gha - cache-to: type=gha,mode=max tags: | ghcr.io/sayaandy/saya-today-web:latest ghcr.io/sayaandy/saya-today-web:stable @@ -75,7 +73,13 @@ jobs: - name: Test SSH connection run: | - ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" + ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" + + - name: Install Ansible + shell: bash + run: | + sudo apt update + sudo apt install -y ansible - name: Run Ansible playbook env: @@ -83,9 +87,8 @@ jobs: working-directory: ./deploy run: | ansible-playbook \ - playbook.yml \ -i inventory.yml \ - -l prod \ + -l prod playbook.yml \ --private-key ~/.ssh/id_ed25519 \ -u svc_github \ -e saya_today_web_auth_salt="${{ secrets.AUTH_SALT }}" \ diff --git a/.github/workflows/build-and-deploy-stage.yml b/.github/workflows/build-and-deploy-stage.yml index ce4a1fb..93a2627 100644 --- a/.github/workflows/build-and-deploy-stage.yml +++ b/.github/workflows/build-and-deploy-stage.yml @@ -9,8 +9,6 @@ jobs: environment: Stage permissions: packages: write - outputs: - sha_short: ${{ steps.ghss_vars.outputs.sha_short }} steps: - name: Checkout uses: actions/checkout@v6 @@ -37,7 +35,7 @@ jobs: - name: Set github short sha id: ghss_vars - run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Build and push uses: docker/build-push-action@v7 @@ -45,8 +43,6 @@ jobs: context: . file: ./Dockerfile push: true - cache-from: type=gha - cache-to: type=gha,mode=max tags: | ghcr.io/sayaandy/saya-today-web:latest ghcr.io/sayaandy/saya-today-web:commit-${{ steps.ghss_vars.outputs.sha_short }} @@ -79,7 +75,11 @@ jobs: - name: Test SSH connection run: | - ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" + ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" + + - name: Set github short sha + id: ghss_vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Run Ansible playbook env: @@ -87,16 +87,15 @@ jobs: working-directory: ./deploy run: | ansible-playbook \ - playbook.yml \ -i inventory.yml \ - -l stage \ + -l stage playbook.yml \ --private-key ~/.ssh/id_ed25519 \ -u svc_github \ -e saya_today_web_auth_salt="${{ secrets.AUTH_SALT }}" \ -e saya_today_web_s3_access_key_id="${{ secrets.S3_ACCESS_KEY_ID }}" \ -e saya_today_web_s3_secret_access_key="${{ secrets.S3_SECRET_ACCESS_KEY }}" \ -e saya_today_web_environment=stage \ - -e saya_today_web_tag=commit-${{ needs.build-and-push.outputs.sha_short }} \ + -e saya_today_web_tag=commit-${{ steps.ghss_vars.outputs.sha_short }} \ -e saya_today_web_mail_salt="${{ secrets.MAIL_SALT }}" \ -e saya_today_web_mail_host="${{ secrets.MAIL_HOST }}" \ -e saya_today_web_mail_address="${{ secrets.MAIL_ADDRESS }}" \ |