Skip to content

Commit 9ea66a0

Browse files
Adapt workflow to build from a specific tag
Signed-off-by: GuillaumeBourque-QC <[email protected]>
2 parents 0901835 + b2fd9fa commit 9ea66a0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/build-indy-node-monitor.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,38 @@ jobs:
4242
username: ${{ github.repository_owner }}
4343
password: ${{ secrets.GITHUB_TOKEN }}
4444

45+
- name: Set lowercase username
46+
run: echo "USERNAME=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
47+
- name: Checkout repository main
48+
uses: actions/checkout@v4
49+
with:
50+
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
51+
52+
- name: Extract latest version from Git tag, excludind the v.
53+
run: |
54+
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1` | cut -c2-)
55+
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
56+
echo "LATEST_TAG=$LATEST_TAG"
57+
58+
- name: Checkout repository specific tag
59+
uses: actions/checkout@v4
60+
with:
61+
ref: v${{ inputs.ref || env.LATEST_TAG }}
62+
63+
- name: Log in to the GitHub Container Registry
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.repository_owner }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
69+
4570
- name: Set lowercase username
4671
run: echo "USERNAME=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
4772

4873
- name: Build the Docker image
4974
run: docker build -t ghcr.io/${{ env.USERNAME }}/${{ github.event.repository.name }}/indy-node-monitor:${{ inputs.ref || env.LATEST_TAG }} ./fetch-validator-status/
75+
run: docker build -t ghcr.io/${{ env.USERNAME }}/${{ github.event.repository.name }}/indy-node-monitor:${{ inputs.ref || env.LATEST_TAG }} ./fetch-validator-status/
5076

5177
- name: Push the Docker image
5278
run: docker push ghcr.io/${{ env.USERNAME }}/${{ github.event.repository.name }}/indy-node-monitor:${{ inputs.ref || env.LATEST_TAG }}
79+
run: docker push ghcr.io/${{ env.USERNAME }}/${{ github.event.repository.name }}/indy-node-monitor:${{ inputs.ref || env.LATEST_TAG }}

0 commit comments

Comments
 (0)