|
| 1 | +# /******************************************************************************** |
| 2 | +# * Copyright (c) 2022 Contributors to the Eclipse Foundation |
| 3 | +# * |
| 4 | +# * See the NOTICE file(s) distributed with this work for additional |
| 5 | +# * information regarding copyright ownership. |
| 6 | +# * |
| 7 | +# * This program and the accompanying materials are made available under the |
| 8 | +# * terms of the Apache License 2.0 which is available at |
| 9 | +# * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# * |
| 11 | +# * SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ********************************************************************************/ |
| 13 | + |
| 14 | +name: kuksa_databroker_release |
| 15 | + |
| 16 | +on: |
| 17 | + # workflow_dispatch: #TODO: input versions manually |
| 18 | + push: |
| 19 | + tags: |
| 20 | + - "databroker-v*.*.*" |
| 21 | + |
| 22 | +jobs: |
| 23 | + build_databroker: |
| 24 | + uses: ./.github/workflows/kuksa_databroker_build.yml |
| 25 | + create_release: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + needs: [build_databroker] |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v3 |
| 31 | + - name: Get the version |
| 32 | + id: get_version |
| 33 | + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/databroker-/} |
| 34 | + |
| 35 | + - name: Download all artifacts |
| 36 | + uses: actions/download-artifact@v3 |
| 37 | + with: |
| 38 | + path: bin/ |
| 39 | + - name: Create release |
| 40 | + id: create_release |
| 41 | + uses: softprops/action-gh-release@v1 |
| 42 | + with: |
| 43 | + draft: true |
| 44 | + fail_on_unmatched_files: true |
| 45 | + files: | |
| 46 | + bin/** |
| 47 | + LICENSE |
| 48 | + NOTICE.md |
| 49 | +
|
| 50 | + release-databroker-image: |
| 51 | + name: "Download and push to ghcr (databroker)" |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + needs: [build_databroker] |
| 55 | + steps: |
| 56 | + - id: repository-name-adjusted |
| 57 | + name: Prepare repository name in lower case for docker upload. This supports repository names in mixed case |
| 58 | + uses: ASzc/change-string-case-action@v2 |
| 59 | + with: |
| 60 | + string: ${{ github.repository }} |
| 61 | + |
| 62 | + - name: Get the version |
| 63 | + id: get_version |
| 64 | + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/databroker-/} |
| 65 | + |
| 66 | + - name: Retrieve saved Docker image |
| 67 | + uses: actions/download-artifact@v3 |
| 68 | + with: |
| 69 | + name: databroker-oci-multiarch.tar |
| 70 | + path: ${{github.workspace}} |
| 71 | + |
| 72 | + - name: Login to GitHub Container Registry |
| 73 | + uses: docker/login-action@v1 |
| 74 | + with: |
| 75 | + registry: ghcr.io |
| 76 | + username: ${{ github.repository_owner }} |
| 77 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + |
| 79 | + - name: "Push image to ghcr" |
| 80 | + env: |
| 81 | + VAL_NAME: databroker |
| 82 | + VAL_VERSION: ${{ steps.get_version.outputs.version }} |
| 83 | + GIT_HUB_REPOSITORY_NAME_LOWER_CASE: ${{ steps.repository-name-adjusted.outputs.lowercase }} |
| 84 | + shell: bash |
| 85 | + run: | |
| 86 | + skopeo copy --all oci-archive:databroker-oci-multiarch.tar "docker://ghcr.io/$GIT_HUB_REPOSITORY_NAME_LOWER_CASE/$VAL_NAME:$VAL_VERSION" |
| 87 | + skopeo inspect --raw "docker://ghcr.io/$GIT_HUB_REPOSITORY_NAME_LOWER_CASE/$VAL_NAME:$VAL_VERSION" | jq |
| 88 | + skopeo inspect "docker://ghcr.io/$GIT_HUB_REPOSITORY_NAME_LOWER_CASE/$VAL_NAME:$VAL_VERSION" |
0 commit comments