diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b03ed92..5a5960a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: self-hosted strategy: matrix: node-version: [18] @@ -26,7 +26,7 @@ jobs: - run: pnpm lint build: - runs-on: ubuntu-latest + runs-on: self-hosted strategy: matrix: node-version: [18] @@ -45,7 +45,7 @@ jobs: - run: pnpm build test: - runs-on: ubuntu-latest + runs-on: self-hosted strategy: matrix: node-version: [18] @@ -63,10 +63,10 @@ jobs: ports: - 3306:3306 - options: --name mariadb --health-cmd="mysqladmin ping" --health-interval=1s --health-timeout=5s --health-retries=3 + options: --name mariadb --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=30s --health-retries=5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 with: version: 9 @@ -98,7 +98,7 @@ jobs: - build - test steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 with: version: 9 @@ -116,33 +116,24 @@ jobs: deploy: if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' - runs-on: ubuntu-latest + runs-on: self-hosted needs: - lint - build - test - env: - RESOURCE_NAME: ${{ github.ref == 'refs/heads/master' && 'prod-api' || 'dev-api' }} steps: - - uses: actions/checkout@v2 - - name: Install oc - uses: redhat-actions/oc-installer@v1 - with: - oc_version: '4.6' - - name: Login to OKD - run: oc login --token=${{ secrets.OKD_TOKEN }} --server=${{ secrets.OKD_SERVER }} - - - name: Change the project - run: oc project ${{ secrets.OKD_PROJECT }} - - - name: Start the build - run: oc start-build ${{ env.RESOURCE_NAME }} --follow - - - uses: lazy-actions/slatify@master - if: always() + - uses: actions/checkout@v4 + - name: Install docker + uses: docker/setup-buildx-action@v3 + - name: Login to registry + uses: docker/login-action@v3 with: - type: ${{ job.status }} - job_name: '*Deployment to ${{ env.RESOURCE_NAME }}*' - commit: true - url: ${{ secrets.SLACK_WEBHOOK_URL }} - token: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ secrets.REGISTRY_URL }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: | + ${{ secrets.REGISTRY_URL }}/uttarena/api:${{ github.ref == 'refs/heads/master' && 'master' || 'dev' }}