Skip to content

Update version (#34) #3

Update version (#34)

Update version (#34) #3

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: Create/update tag
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version from setup.py
id: getVersions
run: |
semantic_version=$(python setup.py --version)
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: Check manual created tag
id: manualTag
if: github.ref_type == 'tag'
run: |
if [ "${GITHUB_REF#refs/*/}" != ${{ steps.getVersions.outputs.semantic_version }} ]; then
echo "Please align desired tag: '${GITHUB_REF#refs/*/}' ${{ github.ref }} with setup.py version '${{ steps.getVersions.outputs.semantic_version }}'"
echo "Deleting manual created tag"
git push --delete origin ${GITHUB_REF#refs/*/}
exit 1
else
echo "All fine"
fi
- name: Create full version tag - ${{ steps.getVersions.outputs.semantic_version }}
uses: rickstaa/action-create-tag@v1
id: "tag_create_full_version"
with:
tag: ${{ steps.getVersions.outputs.semantic_version }}
tag_exists_error: true
force_push_tag: false
message: "${{ steps.getVersions.outputs.semantic_version }}"
- name: Create major.minor version tag - ${{ steps.getVersions.outputs.major_minor_version }}
uses: rickstaa/action-create-tag@v1
id: "tag_create_major_minor"
with:
tag: ${{ steps.getVersions.outputs.major_minor_version }}
tag_exists_error: false
force_push_tag: true
message: "${{ steps.getVersions.outputs.major_minor_version }}"
- name: Create major version tag - ${{ steps.getVersions.outputs.major_version }}
uses: rickstaa/action-create-tag@v1
id: "tag_create_major"
with:
tag: ${{ steps.getVersions.outputs.major_version }}
tag_exists_error: false
force_push_tag: true
message: "${{ steps.getVersions.outputs.major_version }}"