add missing dydx upgrade #760
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: chains-build | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
env: | |
AWS_REGION: "us-east-1" | |
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY }}" | |
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_KEY }}" | |
AWS_DEFAULT_OUTPUT: "json" | |
jobs: | |
# JOB to run change detection | |
filtered: | |
runs-on: ubuntu-latest | |
# Required permissions | |
permissions: | |
contents: read | |
pull-requests: read | |
outputs: | |
# Expose matched filters as job output variable | |
upgrades: ${{ steps.choice.outputs.upgrades_files }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
list-files: 'json' | |
filters: | | |
upgrades: 'chains/*/upgrades.yml' | |
- id: choice | |
shell: bash | |
run: | | |
if [[ "${{ github.event.ref }}" == "refs/tags/v"* ]]; then | |
echo "upgrades_files=$(echo "[\"$(ls -d chains/*/upgrades.* | paste -sd ',' | sed -e 's/,/","/g')\"]")" >> "$GITHUB_OUTPUT" | |
else | |
echo 'upgrades_files=${{ steps.filter.outputs.upgrades_files }}' >> "$GITHUB_OUTPUT" | |
fi | |
build: | |
needs: filtered | |
strategy: | |
fail-fast: false | |
matrix: | |
upgrades: ${{ fromJSON(needs.filtered.outputs.upgrades) }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# https://docs.docker.com/build/ci/github-actions/multi-platform/ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Convert previous steps output to env var | |
run: | | |
echo "ECR_REGISTRY=${{ steps.login-ecr.outputs.registry }}" >> ${GITHUB_ENV} | |
- name: Log in to the github container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set env vars | |
shell: bash | |
run: | | |
CHAIN_DIR=$(basename $(dirname ${{ matrix.upgrades }})) | |
CHAIN_NAME=${CHAIN_DIR%%-*} | |
CHAIN_NETWORK=${CHAIN_DIR##*-} | |
SUFFIX=${CHAIN_DIR#*-} | |
echo "CHAIN_DIR=${CHAIN_DIR}" >> $GITHUB_ENV | |
echo "CHAIN_NAME=${CHAIN_NAME}" >> $GITHUB_ENV | |
echo "CHAIN_NETWORK=${CHAIN_NETWORK}" >> $GITHUB_ENV | |
echo "TAG_PREFIX=${CHAIN_NAME}-${CHAIN_NETWORK}-" >> $GITHUB_ENV | |
if [[ "${SUFFIX}" != "${CHAIN_NETWORK}" ]]; then | |
echo "TAG_SUFFIX=-${SUFFIX%%-*}" >> $GITHUB_ENV | |
else | |
#echo "TAG_SUFFIX=\"\"" >> $GITHUB_ENV | |
echo "TAG_SUFFIX=" >> $GITHUB_ENV | |
fi | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
images: | | |
ghcr.io/${{ github.repository }} | |
${{ env.ECR_REGISTRY }}/cosmovisor | |
flavor: | | |
latest=false | |
tags: | | |
type=sha,prefix=${{ env.TAG_PREFIX }},suffix=${{ env.TAG_SUFFIX }} | |
type=semver,pattern={{version}},prefix=${{ env.TAG_PREFIX }},suffix=${{ env.TAG_SUFFIX }} | |
type=raw,value=${{ env.TAG_PREFIX }}latest${{ env.TAG_SUFFIX }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Build docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
file: Dockerfile | |
platforms: linux/amd64 | |
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} | |
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }} | |
build-args: | | |
CHAIN_DIR=${{ env.CHAIN_DIR }} | |
CHAIN_NAME=${{ env.CHAIN_NAME }} | |
CHAIN_NETWORK=${{ env.CHAIN_NETWORK }} | |