first commit #1
Workflow file for this run
This file contains hidden or 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: Build & publish Namada image | |
| #————————————————————————————————————————— | |
| # 1. Run ONLY when we push a tag ‘v<node>-<imgRev>’ (e.g. v1.1.0-1beta) | |
| #————————————————————————————————————————— | |
| on: | |
| push: | |
| tags: [ 'v*-*' ] # any vX.Y.Z-whatever | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} # ghcr.io/<owner>/<repo> | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # checkout | |
| packages: write # push to GHCR | |
| steps: | |
| # ———————————————————————————————————————— | |
| # 2. Grab the code | |
| # ———————————————————————————————————————— | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| # ———————————————————————————————————————— | |
| # 3. Work out the two versions from the tag | |
| # tag=v1.1.0-1beta → node=1.1.0 imgRev=1beta | |
| # ———————————————————————————————————————— | |
| - name: Parse tag parts | |
| id: versions | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" # e.g. v1.1.0-1beta | |
| NODE_VERSION="${TAG%%-*}" # v1.1.0 | |
| IMAGE_REV="${TAG#*-}" # 1beta | |
| echo "NODE_VERSION=$NODE_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "IMAGE_REV=$IMAGE_REV" >> "$GITHUB_OUTPUT" | |
| echo "GIT_TAG=$TAG" >> "$GITHUB_OUTPUT" | |
| # ———————————————————————————————————————— | |
| # 4. Log in to the container registry | |
| # ———————————————————————————————————————— | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/setup-buildx-action@v3 | |
| # ———————————————————————————————————————— | |
| # 5. Create the image tag list (just the Git tag) | |
| # ———————————————————————————————————————— | |
| - name: Generate Docker tags | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=${{ steps.versions.outputs.GIT_TAG }} | |
| visibility: public | |
| # ———————————————————————————————————————— | |
| # 6. Build & push | |
| # ———————————————————————————————————————— | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64 # add ,linux/arm64 if you need multi‑arch | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| NAMADA_VERSION=${{ steps.versions.outputs.NODE_VERSION }} | |
| cache-from: type=gha,scope=${{ github.ref_name }} | |
| cache-to: type=gha,mode=max,scope=${{ github.ref_name }} |