Release #6
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: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: 'version to be released' | |
required: true | |
default: '' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure Git user | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install dependencies | |
run: pip install semantic_version | |
- name: Tag and push a release | |
id: release | |
run: | | |
./build/release.sh -v "${{ github.event.inputs.release_version }}" | |
read -r major minor patch prerelease build <<< $(python -c "import semantic_version; v = semantic_version.Version('${{ github.event.inputs.release_version }}'); print(v.major, v.minor, v.patch, '.'.join(v.prerelease), '.'.join(v.build));") | |
if [[ -z "${prerelease}" ]] ; then | |
echo "PRERELEASE=false" >> $GITHUB_ENV | |
else | |
echo "PRERELEASE=true" >> $GITHUB_ENV | |
fi | |
tagName="v${{ github.event.inputs.release_version }}" | |
echo "TAG_NAME=${tagName}" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ env.TAG_NAME }} | |
- name: Generate artifacts and changelog | |
run: | | |
./build/zip_csar.sh | |
- name: Create or Update Github Release draft | |
id: update_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
name: ${{ env.TAG_NAME }} | |
prerelease: ${{ env.PRERELEASE }} | |
draft: true | |
files: build/csars/*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Github Release | |
uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.update_release.outputs.id }} |