github.com/oam-dev/kubevela@v1.9.11/.github/workflows/registry.yml (about)

     1  name: Registry
     2  on:
     3    push:
     4      branches:
     5        - master
     6      tags:
     7        - "v*"
     8    workflow_dispatch: {}
     9  
    10  permissions:
    11    contents: read
    12  
    13  jobs:
    14    publish-core-images:
    15      permissions:
    16        packages: write
    17      runs-on: ubuntu-22.04
    18      steps:
    19        - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
    20        - name: Get the version
    21          id: get_version
    22          run: |
    23            VERSION=${GITHUB_REF#refs/tags/}
    24            if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then
    25              VERSION=latest
    26            fi
    27            echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
    28        - name: Get git revision
    29          id: vars
    30          shell: bash
    31          run: |
    32            echo "git_revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
    33        - name: Login ghcr.io
    34          uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
    35          with:
    36            registry: ghcr.io
    37            username: ${{ github.actor }}
    38            password: ${{ secrets.GITHUB_TOKEN }}
    39        - name: Login docker.io
    40          uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
    41          with:
    42            registry: docker.io
    43            username: ${{ secrets.DOCKER_USERNAME }}
    44            password: ${{ secrets.DOCKER_PASSWORD }}
    45        - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
    46        - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
    47          with:
    48            driver-opts: image=moby/buildkit:master
    49  
    50        - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
    51          name: Build & Pushing vela-core for Dockerhub, GHCR
    52          with:
    53            context: .
    54            file: Dockerfile
    55            labels: |-
    56              org.opencontainers.image.source=https://github.com/${{ github.repository }}
    57              org.opencontainers.image.revision=${{ github.sha }}
    58            platforms: linux/amd64,linux/arm64
    59            push: ${{ github.event_name != 'pull_request' }}
    60            build-args: |
    61              GITVERSION=git-${{ steps.vars.outputs.git_revision }}
    62              VERSION=${{ steps.get_version.outputs.VERSION }}
    63              GOPROXY=https://proxy.golang.org
    64            tags: |-
    65              docker.io/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
    66              ghcr.io/${{ github.repository_owner }}/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
    67  
    68        - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
    69          name: Build & Pushing CLI for Dockerhub, GHCR
    70          with:
    71            context: .
    72            file: Dockerfile.cli
    73            labels: |-
    74              org.opencontainers.image.source=https://github.com/${{ github.repository }}
    75              org.opencontainers.image.revision=${{ github.sha }}
    76            platforms: linux/amd64,linux/arm64
    77            push: ${{ github.event_name != 'pull_request' }}
    78            build-args: |
    79              GITVERSION=git-${{ steps.vars.outputs.git_revision }}
    80              VERSION=${{ steps.get_version.outputs.VERSION }}
    81              GOPROXY=https://proxy.golang.org
    82            tags: |-
    83              docker.io/oamdev/vela-cli:${{ steps.get_version.outputs.VERSION }}
    84              ghcr.io/${{ github.repository_owner }}/oamdev/vela-cli:${{ steps.get_version.outputs.VERSION }}