From 95246090920588223f6db4c81634ceedc4162a8d Mon Sep 17 00:00:00 2001 From: Krzysztof Durek <21038648+kdurek@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:32:33 +0200 Subject: [PATCH] ci: split workflows to separate files --- .github/workflows/pull-request.yml | 34 ++++------------------------- .github/workflows/push.yml | 35 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 27805973..97fffc7f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,17 +1,16 @@ name: Pull request + on: pull_request: branches: - main - canary - push: - branches: - - main - - canary +env: + HUSKY: 0 + jobs: build-app: - if: github.event_name == 'pull_request' runs-on: ubuntu-latest strategy: matrix: @@ -45,28 +44,3 @@ jobs: - name: Run Tests run: pnpm run test - - build-and-push-docker-on-push: - if: github.event_name == 'push' - runs-on: ubuntu-latest - steps: - - name: Check out the code - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Prepare .env file - run: | - cp .env.production.example .env.production - - - name: Build and push Docker image using custom script - run: | - chmod +x ./docker/push.sh - ./docker/push.sh ${{ github.ref_name == 'canary' && 'canary' || '' }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 00000000..1534e6d2 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,35 @@ +name: Push + +on: + push: + branches: + - main + - canary + +env: + HUSKY: 0 + +jobs: + build-and-push-docker-on-push: + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Prepare .env file + run: | + cp .env.production.example .env.production + + - name: Build and push Docker image using custom script + run: | + chmod +x ./docker/push.sh + ./docker/push.sh ${{ github.ref_name == 'canary' && 'canary' || '' }}