Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Creating python invoker #34

Creating python invoker

Creating python invoker #34

# Copyright 2021-2022 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
name: Create Invoker Release
run-name: Creating ${{ inputs.invoker }} invoker
on:
workflow_dispatch:
inputs:
invoker:
type: choice
description: Select an invoker
options:
- python
- java
release-type:
type: choice
description: The type of release
options:
- patch
- minor
- major
pre-release-label:
type: string
description: Pre-release label
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- id: version
uses: ./.github/actions/semver-bump
with:
path: ./invokers/${{ github.event.inputs.invoker }}/VERSION
release-type: ${{ github.event.inputs.release-type }}
pre-release: ${{ github.event.inputs.pre-release-label }}
- name: Bump version
env:
path: ./invokers/${{ github.event.inputs.invoker }}/VERSION
version: ${{ steps.version.outputs.version }}
run: |
printf $version > $path
- name: Run Tests
env:
target: invokers.${{ github.event.inputs.invoker }}.tests
run: |
make $target
- name: Build
env:
target: invokers.${{ github.event.inputs.invoker }}
run: |
make $target
- name: Commit Version
env:
path: ./invokers/${{ github.event.inputs.invoker }}/VERSION
message: "Update ${{ github.event.inputs.invoker }} invoker version to ${{ steps.version.outputs.version }}"
run: |
git add $path
git config user.name github-actions
git config user.email [email protected]
git commit -m "${message}"
git push
- name: Create Tag
id: tag
env:
tag: ${{ github.event.inputs.invoker }}-invoker/v${{ steps.version.outputs.version }}
run: |
git tag $tag
git push --tags
echo "::set-output name=tag::$tag"
- id: artifacts
env:
files_path: "./out/invokers/${{ github.event.inputs.invoker }}"
run: |
files=$files_path/*.sha256
echo 'invoker_files<<EOF' >> $GITHUB_ENV
ls ${files} | rev | cut -d. -f 2- | rev >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo 'invoker_sha_files<<EOF' >> $GITHUB_ENV
ls ${files} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo 'invoker_sha_content<<EOF' >> $GITHUB_ENV
cat ${files} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: ${{ github.event.inputs.invoker }}-invoker v${{ steps.version.outputs.version }}
body: |
# File Checksums
```
${{ env.invoker_sha_content }}
```
tag_name: ${{ steps.tag.outputs.tag }}
files: |
${{ env.invoker_files }}
${{ env.invoker_sha_files }}
token: ${{ secrets.GITHUB_TOKEN }}