chore: format files #5112
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 | |
# Docker workflow allows the creation and publishing of new Desmos Docker tags. | |
# This workflow is run only when a new commit is pushed to master, or a new tag is created. | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 | |
- "v[0-9]+.[0-9]+.[0-9]+-testnet" # Push events to matching v*-testnet, i.e. v1.0-testnet, v20.15.10-testnet | |
- "v[0-9]+.[0-9]+.[0-9]+-mainnet" # Push events to matching v*-mainnet, i.e. v1.0-mainnet, v20.15.10-mainnet | |
jobs: | |
Build-and-Publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- name: Create the builder 👷 | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./contrib/images/desmos-builder/Dockerfile | |
load: true | |
tags: desmoslabs/builder:latest | |
- name: Login to DockerHub 👤 | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Prepare tags 🏷️ | |
id: prep | |
run: | | |
DOCKER_IMAGE=desmoslabs/desmos | |
VERSION=edge | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
elif [[ $GITHUB_REF == refs/heads/* ]]; then | |
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') | |
elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
VERSION=pr-${{ github.event.number }} | |
fi | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
if [ "${{ github.event_name }}" = "push" ]; then | |
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}" | |
fi | |
echo ::set-output name=version::${VERSION} | |
echo ::set-output name=tags::${TAGS} | |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
- name: Build and push 📤 | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.prep.outputs.tags }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | |
org.opencontainers.image.revision=${{ github.sha }} |