github.com/IBM-Blockchain/fabric-operator@v1.0.4/.github/workflows/release.yaml (about)

     1  name: Release Operator
     2  
     3  on:
     4    pull_request:
     5      branches: [ release-1.0 ]
     6    push:
     7      tags: [ v1.* ]
     8  
     9  env:
    10    GO_VER: 1.18.4
    11    GO_TAGS: ""
    12    REGISTRY: ghcr.io
    13    IMAGE_NAME: ${{ github.repository }}
    14    SEMREV_LABEL: ${{ github.ref_name }}
    15  
    16  permissions:
    17    contents: read
    18  
    19  jobs:
    20    build-and-push-image:
    21      runs-on: ubuntu-20.04
    22  
    23      permissions:
    24        contents: read
    25        packages: write
    26  
    27      steps:
    28        - name: Set up QEMU
    29          uses: docker/setup-qemu-action@v2
    30  
    31        - name: Set up Docker Buildx
    32          uses: docker/setup-buildx-action@v2
    33          with:
    34            buildkitd-flags: --debug
    35            config-inline: |
    36              [worker.oci]
    37                max-parallelism = 1
    38  
    39        - name: Checkout
    40          uses: actions/checkout@v3
    41  
    42        - name: Login to the GitHub Container Registry
    43          uses: docker/login-action@v2
    44          with:
    45            registry: ${{ env.REGISTRY }}
    46            username: ${{ github.actor }}
    47            password: ${{ secrets.GITHUB_TOKEN }}
    48  
    49        - name: Docker meta
    50          id: meta
    51          uses: docker/metadata-action@v4
    52          with:
    53            images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
    54            tags: |
    55              type=semver,pattern={{version}}
    56              type=semver,pattern={{major}}.{{minor}}
    57              type=semver,pattern={{major}}.{{minor}}.{{patch}}
    58  
    59        - name: Build and push
    60          id: push
    61          uses: docker/build-push-action@v3
    62          with:
    63            context: .
    64            file: Dockerfile
    65            platforms: linux/amd64,linux/arm64
    66            tags: ${{ steps.meta.outputs.tags }}
    67            push: ${{ github.event_name != 'pull_request' }}
    68            labels: ${{ steps.meta.outputs.labels }}
    69            build-args: |
    70              GO_VER=${{ env.GO_VER }}
    71              GO_TAGS=${{ env.GO_TAGS }}
    72              BUILD_ID=${{ env.SEMREV_LABEL }}
    73              BUILD_DATE=${{ env.BUILD_DATE }}
    74  
    75  
    76    create-release:
    77      name: Create GitHub Release
    78      needs: [ build-and-push-image ]
    79      runs-on: ubuntu-20.04
    80      permissions:
    81        contents: write
    82      steps:
    83        - name: Checkout
    84          uses: actions/checkout@v3
    85        - name: Release Operator Version
    86          uses: ncipollo/release-action@v1
    87          with:
    88            allowUpdates: "true"
    89            bodyFile: release_notes/${{ env.SEMREV_LABEL }}.md
    90            tag: ${{ env.SEMREV_LABEL }}
    91            token: ${{ secrets.GITHUB_TOKEN }}