diff --git a/.github/workflows/hasura.yml b/.github/workflows/hasura.yml index c5059d6..610d26f 100644 --- a/.github/workflows/hasura.yml +++ b/.github/workflows/hasura.yml @@ -1,32 +1,41 @@ name: Hasura on: + pull_request: + paths: + - .github/workflows/hasura.yml + - src/hasura/** push: branches: [main] paths: - .github/workflows/hasura.yml - src/hasura/** + jobs: - hasura: - name: Hasura + docker: runs-on: ubuntu-latest steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Apply hasura migrations - uses: tibotiber/hasura-action@v3.0 + - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm,arm64 + - name: Set up buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + if: github.event_name == 'push' + uses: docker/login-action@v2 with: - args: migrate apply --all-databases - env: - HASURA_ENDPOINT: ${{ secrets.HASURA_ENDPOINT }} - HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }} - HASURA_WORKDIR: src/hasura - HASURA_ENGINE_VERSION: v2.33.3 - - name: Apply hasura metadata - uses: tibotiber/hasura-action@v3.0 + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 with: - args: metadata apply - env: - HASURA_ENDPOINT: ${{ secrets.HASURA_ENDPOINT }} - HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }} - HASURA_WORKDIR: src/hasura - HASURA_ENGINE_VERSION: v2.33.3 + context: ./src/hasura + file: ./src/hasura/Dockerfile + push: ${{ github.event_name == 'push' }} + tags: | + ghcr.io/${{ github.repository_owner }}/microservices-example/hasura:build-${{ github.run_number }} + ghcr.io/${{ github.repository_owner }}/microservices-example/hasura:latest + cache-from: type=gha + cache-to: type=gha,mode=max