refactor: update #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
concurrency: production | |
on: | |
push: | |
branches: [master] | |
jobs: | |
check_changes: | |
runs-on: ubuntu-latest | |
outputs: | |
backend_ci: ${{ steps.filter.outputs.backend_ci }} | |
backend_cd: ${{ steps.filter.outputs.backend_cd }} | |
backend_playwright_cd: ${{ steps.filter.outputs.backend_playwright_cd }} | |
frontend_cd: ${{ steps.filter.outputs.frontend_cd }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
backend_ci: | |
- './volumes/backend/**' | |
- './containers/backend/**' | |
backend_cd: | |
- './volumes/backend/!(spec)/**' | |
- './containers/backend/**' | |
backend_playwright_cd: | |
- './containers/backend_playwright/**' | |
frontend_cd: | |
- './volumes/frontend/**' | |
- './containers/frontend/**' | |
backend_ci: | |
needs: check_changes | |
if: ${{ needs.check_changes.outputs.backend_ci == 'true' }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Execute CI | |
run: | | |
touch .env | |
docker compose build backend | |
docker compose run backend rails db:create | |
docker compose run backend rails db:migrate | |
docker compose run backend rspec | |
- name: Set CI Result | |
if: ${{ success() }} | |
run: echo "result=true" >> $GITHUB_OUTPUT | |
backend_cd: | |
needs: | |
- check_changes | |
- backend_ci | |
if: ${{ needs.check_changes.outputs.backend_cd == 'true' }} | |
uses: ./.github/workflows/reusable-cd.yml | |
with: | |
service_name: "k8s/manifests/price-monitoring" | |
build_command: "make build-backend tag_suffix=${{ github.sha }}" | |
push_command: "make push-backend tag_suffix=${{ github.sha }}" | |
apply_command: "make apply-backend tag_suffix=${{ github.sha }}" | |
secrets: | |
REGISTRY_IP: ${{ secrets.REGISTRY_IP }} | |
REGISTRY_CRT: ${{ secrets.REGISTRY_CRT }} | |
REGISTRY_KEY: ${{ secrets.REGISTRY_KEY }} | |
CA_CRT: ${{ secrets.CA_CRT }} | |
CLIENT_CRT: ${{ secrets.CLIENT_CRT }} | |
CLIENT_KEY: ${{ secrets.CLIENT_KEY }} | |
SECRET_TEXT: ${{ secrets.SECRET_TEXT }} | |
VPN_OVPN: ${{ secrets.VPN_OVPN }} | |
GIT_COMMIT_USER: ${{ secrets.GIT_COMMIT_USER }} | |
GIT_COMMIT_EMAIL: ${{ secrets.GIT_COMMIT_EMAIL }} | |
GIT_REPO_USER: ${{ secrets.GIT_REPO_USER }} | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
backend_playwright_cd: | |
needs: check_changes | |
if: ${{ needs.check_changes.outputs.backend_playwright_cd == 'true' }} | |
uses: ./.github/workflows/reusable-cd.yml | |
with: | |
service_name: "k8s/manifests/price-monitoring" | |
build_command: "make build-backend-playwright tag_suffix=${{ github.sha }}" | |
push_command: "make push-backend-playwright tag_suffix=${{ github.sha }}" | |
apply_command: "make apply-backend-playwright tag_suffix=${{ github.sha }}" | |
secrets: | |
REGISTRY_IP: ${{ secrets.REGISTRY_IP }} | |
REGISTRY_CRT: ${{ secrets.REGISTRY_CRT }} | |
REGISTRY_KEY: ${{ secrets.REGISTRY_KEY }} | |
CA_CRT: ${{ secrets.CA_CRT }} | |
CLIENT_CRT: ${{ secrets.CLIENT_CRT }} | |
CLIENT_KEY: ${{ secrets.CLIENT_KEY }} | |
SECRET_TEXT: ${{ secrets.SECRET_TEXT }} | |
VPN_OVPN: ${{ secrets.VPN_OVPN }} | |
GIT_COMMIT_USER: ${{ secrets.GIT_COMMIT_USER }} | |
GIT_COMMIT_EMAIL: ${{ secrets.GIT_COMMIT_EMAIL }} | |
GIT_REPO_USER: ${{ secrets.GIT_REPO_USER }} | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
frontend_cd: | |
needs: check_changes | |
if: ${{ needs.check_changes.outputs.frontend_cd == 'true' }} | |
uses: ./.github/workflows/reusable-cd.yml | |
with: | |
service_name: "k8s/manifests/price-monitoring" | |
build_command: "make build-frontend tag_suffix=${{ github.sha }}" | |
push_command: "make push-frontend tag_suffix=${{ github.sha }}" | |
apply_command: "make apply-frontend tag_suffix=${{ github.sha }}" | |
secrets: | |
REGISTRY_IP: ${{ secrets.REGISTRY_IP }} | |
REGISTRY_CRT: ${{ secrets.REGISTRY_CRT }} | |
REGISTRY_KEY: ${{ secrets.REGISTRY_KEY }} | |
CA_CRT: ${{ secrets.CA_CRT }} | |
CLIENT_CRT: ${{ secrets.CLIENT_CRT }} | |
CLIENT_KEY: ${{ secrets.CLIENT_KEY }} | |
SECRET_TEXT: ${{ secrets.SECRET_TEXT }} | |
VPN_OVPN: ${{ secrets.VPN_OVPN }} | |
GIT_COMMIT_USER: ${{ secrets.GIT_COMMIT_USER }} | |
GIT_COMMIT_EMAIL: ${{ secrets.GIT_COMMIT_EMAIL }} | |
GIT_REPO_USER: ${{ secrets.GIT_REPO_USER }} | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} |