chore: add conditions to not run PRs on draft PRs #134
Workflow file for this run
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: Docker | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "docker/**" | |
- ".github/workflows/docker.yaml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "docker/**" | |
- ".github/workflows/docker.yaml" | |
types: [opened, reopened, synchronize, ready_for_review] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-docker | |
cancel-in-progress: true | |
jobs: | |
build-push-types: | |
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
# subdirs of docker/ directory to build | |
strategy: | |
matrix: | |
build-type: [ "explorers", "faucet", "relayers", "starship" ] | |
max-parallel: 4 | |
env: | |
DOCKER_REPO: ghcr.io/cosmology-tech/starship | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
if: github.event_name == 'pull_request' | |
run: | | |
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all | |
- name: Build and push | |
if: github.event_name == 'push' | |
run: | | |
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push | |
- name: Force Build and Push for workflow dispatch | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
./scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push --force | |
build-push-chains: | |
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
env: | |
DOCKER_REPO: ghcr.io/cosmology-tech/starship | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build chains | |
if: github.event_name == 'pull_request' | |
run: | | |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all | |
- name: Build and push all chains | |
if: github.event_name == 'push' | |
run: | | |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all --push | |
- name: Force Build and Push for workflow dispatch | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all --push --force |