release_trigger #58
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
name: Release | |
on: | |
repository_dispatch: | |
types: [release_trigger] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'version of superbuild' | |
required: true | |
default: 'v2023.x.y' | |
env: | |
REPOSITORY_NAME: ${{ github.repository }} | |
REPOSITORY_NAME_ONLY: ${{ github.event.repository.name }} | |
jobs: | |
build: | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get Version | |
id: get_version | |
run: | | |
if [[ "${{github.event_name}}" == "repository_dispatch" ]] | |
then | |
echo "version=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT | |
else | |
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Debug | |
id: debug | |
run : | | |
echo "my version is ${{ steps.get_version.outputs.version }}" | |
echo "my REPOSITORY_NAME is ${{ env.REPOSITORY_NAME }} " | |
echo "my REPOSITORY_NAME_ONLY is ${{ env.REPOSITORY_NAME_ONLY }} " | |
- name: Check Tag | |
id: check_tag | |
uses: mukunku/[email protected] | |
with: | |
tag: ${{ steps.get_version.outputs.version }} | |
- name: degug check tag | |
id: debug_check_tag | |
run: | | |
if [[ "${{steps.check_tag.outputs.exists}}" == "true" ]] | |
then | |
echo "the version ${{ steps.get_version.outputs.version }} exist" | |
else | |
echo "the version ${{ steps.get_version.outputs.version }} NOT exist" | |
fi | |
- name: Create Release | |
id: create_release | |
if: ${{ steps.check_tag.outputs.exists == 'false' }} | |
uses: action-pack/github-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
title: ${{ env.REPOSITORY_NAME_ONLY }} ${{ steps.get_version.outputs.version }} | |
tag: ${{ steps.get_version.outputs.version }} | |
body: | | |
Release ${{ steps.get_version.outputs.version }} | |
#draft: false | |
#prerelease: false | |
- name: Repository Dispatch for building images | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ env.REPOSITORY_NAME }} | |
event-type: repository_trigger | |
client-payload: '{"version": "${{ steps.get_version.outputs.version }}", "type": "repository_trigger", "img_list": "superbuild superbuild-icubhead superbuild-icubhead-withuser superbuild-gazebo superbuild-ros2"}' | |