Merge pull request #21 from DefiantLabs/patch/proper-type-output #66
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 Package | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: false | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
tags: | |
description: 'Test scenario tags' | |
required: false | |
type: boolean | |
environment: | |
description: 'Environment to run tests against' | |
type: environment | |
required: false | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
labels: | | |
maintainer=danb | |
org.opencontainers.image.source=https://github.com/defiantlabs/cosmos-upgrades | |
org.opencontainers.image.title=cosmos-upgrades | |
org.opencontainers.image.description=cosmos-upgrades | |
org.opencontainers.image.vendor=Defiant | |
tags: | | |
type=sha,enable=true,prefix=sha-,suffix=,format=short,priority=1 | |
type=semver,pattern={{raw}},priority=2 | |
type=edge,branch=main,priority=3 | |
type=ref,event=branch,priority=4 | |
type=ref,event=tag,priority=5 | |
type=ref,event=pr,priority=6 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64 | |
file: Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |