|
12 | 12 | ref: |
13 | 13 | required: false |
14 | 14 | type: string |
15 | | - description: "This is the tag version number use to build and publish the container. Don't include the v like this 2.4.6, if you dont provide a version we will get the latest tag version from the repo" |
| 15 | + 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" |
16 | 16 |
|
17 | 17 | jobs: |
18 | 18 | build: |
@@ -42,11 +42,38 @@ jobs: |
42 | 42 | username: ${{ github.repository_owner }} |
43 | 43 | password: ${{ secrets.GITHUB_TOKEN }} |
44 | 44 |
|
| 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 | + |
45 | 70 | - name: Set lowercase username |
46 | 71 | run: echo "USERNAME=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV |
47 | 72 |
|
48 | 73 | - name: Build the Docker image |
49 | 74 | 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/ |
50 | 76 |
|
51 | 77 | - name: Push the Docker image |
52 | 78 | 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