chore: purge docker image versions (#575) #230
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 | |
- release/* | |
paths: | |
- "starship/docker/**" | |
- ".github/workflows/docker.yaml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "starship/docker/**" | |
- ".github/workflows/docker.yaml" | |
types: [opened, reopened, synchronize, ready_for_review] | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'Type of docker image to build' | |
type: choice | |
required: true | |
options: | |
- "explorers" | |
- "faucet" | |
- "relayers" | |
- "starship" | |
- "chains" | |
process: | |
description: 'Process to run' | |
type: string | |
default: "all" | |
version: | |
description: 'Version of docker image to build' | |
type: string | |
default: "all" | |
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: | | |
./starship/scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all | |
- name: Build and push | |
if: github.event_name == 'push' | |
run: | | |
./starship/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' && github.event.inputs.type == matrix.build-type | |
run: | | |
./starship/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 | |
defaults: | |
run: | |
working-directory: 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' && github.event.inputs.type == 'chains' | |
run: | | |
cd docker/chains && ./build-docker-chains.sh --chain $PROCESS --tag $VERSION --push --force | |
env: | |
PROCESS: ${{ github.event.inputs.process }} | |
VERSION: ${{ github.event.inputs.version }} | |