Skip to content

Update install-velocitas-cli.sh (#74) #43

Update install-velocitas-cli.sh (#74)

Update install-velocitas-cli.sh (#74) #43

Workflow file for this run

# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
workflow_dispatch:
jobs:
wait-for-images:
runs-on: ubuntu-latest
name: Wait for container images
steps:
- name: Wait for build-base-images workflow to succeed
uses: fountainhead/[email protected]
with:
checkName: Building image (cpp)
token: ${{ secrets.GITHUB_TOKEN }}
timeoutSeconds: 5400
intervalSeconds: 120
initialize-matrix:
runs-on: ubuntu-latest
name: Setting up build matrix
needs: [wait-for-images]
strategy:
matrix:
image: [base, python, cpp]
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: github-repository-name-case-adjusted
name: Prepare repository name in lower case for docker upload.
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- uses: docker/setup-buildx-action@v3
id: buildx
with:
install: true
- name: Get version from tag
id: getVersions
run: |
semantic_version=$(sed -e "s/^v//" <<< ${{ github.ref_name }})
major_version=$(cut -d '.' -f 1 <<< "$semantic_version")
major_minor_version=$(cut -d '.' -f 1,2 <<< "$semantic_version")
echo "semantic_version=v$semantic_version" >> $GITHUB_OUTPUT
echo "major_version=v$major_version" >> $GITHUB_OUTPUT
echo "major_minor_version=v$major_minor_version" >> $GITHUB_OUTPUT
- name: Tag docker images
run: |
FQ_IMAGE_NAME=ghcr.io/${{ steps.github-repository-name-case-adjusted.outputs.lowercase }}/${{ matrix.image }}
OLD_TAG=${{ github.sha }}
V_XXX=${{ steps.getVersions.outputs.semantic_version }}
V_X=${{ steps.getVersions.outputs.major_version }}
V_XX=${{ steps.getVersions.outputs.major_minor_version }}
if [[ $V_XX != "v0.0" ]] ; then
docker buildx imagetools create -t $FQ_IMAGE_NAME:$V_XX $FQ_IMAGE_NAME:$OLD_TAG
if [[ $V_X != "v0" ]] ; then
docker buildx imagetools create -t $FQ_IMAGE_NAME:$V_X $FQ_IMAGE_NAME:$OLD_TAG
fi
fi
docker buildx imagetools create -t $FQ_IMAGE_NAME:$V_XXX $FQ_IMAGE_NAME:$OLD_TAG