Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt workflow to build from a specific tag #80

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/build-indy-node-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Docker image

on:
release:
types: [published] # Triggers only when a new release is created


workflow_dispatch:
inputs:
ref:
required: false
type: string
description: "This is the tag version, don't include the v like this 2.4.6, if you dont provide a version we will get the latest tag"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository main
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags

- name: Display release information
run: |
echo "New release created!"
echo "Release tag: ${{ github.event.release.tag_name }}"
echo "Release name: ${{ github.event.release.name }}"
echo "Release body: ${{ github.event.release.body }}"


- name: Checkout repository specific tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.name }} # Ex release name: v0.0.1

- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set lowercase username
run: echo "USERNAME=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Extract version without 'v'
run: echo "VERSION=${{ github.event.release.tag_name }}" | sed 's/^v//' >> $GITHUB_ENV

- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker image
run: docker build -t ghcr.io/${{ env.USERNAME }}/${{ github.event.repository.name }}/indy-node-monitor:${{ env.VERSION }} ./fetch-validator-status/

- name: Push the Docker image
run: docker push ghcr.io/${{ env.USERNAME }}/${{ github.event.repository.name }}/indy-node-monitor:${{ env.VERSION }}