Skip to content

Commit

Permalink
adding new workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciejo committed May 28, 2024
1 parent bbd2b16 commit 0cf52ff
Showing 1 changed file with 35 additions and 17 deletions.
52 changes: 35 additions & 17 deletions .github/workflows/hyperspace-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ on:
- 'v*'

env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
IMAGE_NAME: composablefi/composable-ibc-private/hyperspace

jobs:

build-and-publish:

name: Build & push docker image

runs-on: ubuntu-latest

concurrency:
group: hyperspace-docker-image-${{ github.ref }}
cancel-in-progress: true

strategy:
fail-fast: true

steps:
- name: Clean up
Expand All @@ -48,27 +46,47 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
- name: Extract metadata (tags, labels) for Docker (tag)
id: meta-tag
if: github.ref_type == 'tag'
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Extract metadata (tags, labels) for Docker (branch)
id: meta-branch
if: github.ref_type == 'branch'
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
- name: Login to Docker Hub
uses: docker/login-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image (tag)
if: github.ref_type == 'tag'
uses: docker/build-push-action@v5
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
file: scripts/hyperspace.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-tag.outputs.tags }}
labels: ${{ steps.meta-tag.outputs.labels }}

- name: Build and push Docker image
- name: Build and push Docker image (branch)
if: github.ref_type == 'branch'
uses: docker/build-push-action@v5
with:
file: scripts/hyperspace.Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-branch.outputs.tags }}
labels: ${{ steps.meta-branch.outputs.labels }}

0 comments on commit 0cf52ff

Please sign in to comment.