-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from boschglobal/feature/databroker_release_w…
…orkflow [databroker] Add release workflow
- Loading branch information
Showing
2 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# /******************************************************************************** | ||
# * Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
# * | ||
# * See the NOTICE file(s) distributed with this work for additional | ||
# * information regarding copyright ownership. | ||
# * | ||
# * This program and the accompanying materials are made available under the | ||
# * terms of the Apache License 2.0 which is available at | ||
# * http://www.apache.org/licenses/LICENSE-2.0 | ||
# * | ||
# * SPDX-License-Identifier: Apache-2.0 | ||
# ********************************************************************************/ | ||
|
||
name: kuksa_databroker_release | ||
|
||
on: | ||
# workflow_dispatch: #TODO: input versions manually | ||
push: | ||
tags: | ||
- "databroker-v*.*.*" | ||
|
||
jobs: | ||
build_databroker: | ||
uses: ./.github/workflows/kuksa_databroker_build.yml | ||
create_release: | ||
runs-on: ubuntu-latest | ||
needs: [build_databroker] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/databroker-/} | ||
|
||
- name: Download all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: bin/ | ||
- name: Create release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
fail_on_unmatched_files: true | ||
files: | | ||
bin/** | ||
LICENSE | ||
NOTICE.md | ||
release-databroker-image: | ||
name: "Download and push to ghcr (databroker)" | ||
runs-on: ubuntu-latest | ||
|
||
needs: [build_databroker] | ||
steps: | ||
- id: repository-name-adjusted | ||
name: Prepare repository name in lower case for docker upload. This supports repository names in mixed case | ||
uses: ASzc/change-string-case-action@v2 | ||
with: | ||
string: ${{ github.repository }} | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/databroker-/} | ||
|
||
- name: Retrieve saved Docker image | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: databroker-oci-multiarch.tar | ||
path: ${{github.workspace}} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: "Push image to ghcr" | ||
env: | ||
VAL_NAME: databroker | ||
VAL_VERSION: ${{ steps.get_version.outputs.version }} | ||
GIT_HUB_REPOSITORY_NAME_LOWER_CASE: ${{ steps.repository-name-adjusted.outputs.lowercase }} | ||
shell: bash | ||
run: | | ||
skopeo copy --all oci-archive:databroker-oci-multiarch.tar "docker://ghcr.io/$GIT_HUB_REPOSITORY_NAME_LOWER_CASE/$VAL_NAME:$VAL_VERSION" | ||
skopeo inspect --raw "docker://ghcr.io/$GIT_HUB_REPOSITORY_NAME_LOWER_CASE/$VAL_NAME:$VAL_VERSION" | jq | ||
skopeo inspect "docker://ghcr.io/$GIT_HUB_REPOSITORY_NAME_LOWER_CASE/$VAL_NAME:$VAL_VERSION" |