changelog #387
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
# This workflow pushes new docker images to osmolabs/droid-dev: | |
# | |
# 1. Every new commit to the main branch | |
# `osmolabs/sqs-dev:main-{SHORT_SHA}` is pushed. | |
# `osmolabs/sqs-dev:main-{SHORT_SHA}-$(date +%s)` is pushed. | |
# | |
# Note: $(date +%s) is used to sort the tags in the docker registry. | |
name: Push Dev Images | |
on: | |
push: | |
branches: | |
- "v[0-9]+.x" | |
- osmosis-main | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+-rc*' # include rc | |
env: | |
DOCKER_REPOSITORY: osmolabs/sqs-dev | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Create Docker Image Tags | |
run: | | |
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-8) | |
echo "DOCKER_IMAGE_TAG=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_ENV | |
echo "DOCKER_IMAGE_TAG_WITH_DATE=${{ github.ref_name }}-${SHORT_SHA}-$(date +%s)" >> $GITHUB_ENV | |
echo "BUILD_DATE=$(date +%s)" >> $GITHUB_ENV | |
SHA=$(git rev-parse $(git rev-parse --abbrev-ref HEAD)) | |
echo "SHA=$SHA" >> $GITHUB_ENV | |
- | |
name: Build and Push Docker Images | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile | |
context: . | |
push: true | |
platforms: linux/amd64 | |
tags: | | |
${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} | |
${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG_WITH_DATE }} | |
labels: | | |
repository_full_name=${{ github.repository }} | |
repository_docker=${{ env.DOCKER_REPOSITORY }} | |
ref_name=${{ github.ref_name }} | |
commit_sha=${{ env.SHA }} | |
tag=${{ env.DOCKER_IMAGE_TAG }} | |
build_date=${{ env.BUILD_DATE }} | |
- name: Get default branch name | |
run: echo "The default branch is ${{ github.event.repository.default_branch }} and the actual branch is ${{ github.ref }}" | |
- | |
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
name: Send Webhook to deploy automatically to stage | |
# Note, we modify the config.json to refer to the Docker container name. The reason is that in staging, our | |
# infrastructure is managed by Docker Compose, and we need to refer to the container name for correct networking. | |
run: | | |
echo '{"sqsdockerversion":"${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }}", "commitsha":"${{ env.SHA }}"}' > temp.json | |
jq -s '.[0] * .[1]' config.json temp.json > combined_config.json | |
jq '.["grpc-tendermint-rpc-endpoint"] = "http://osmosis:26657" | .["grpc-gateway-endpoint"] = "osmosis:9090"' combined_config.json > modified_config.json | |
curl -H "Content-Type: application/json" -X POST -d @modified_config.json ${{ secrets.DEPLOY_URL }} | |