Skip to content

Create Release

Create Release #114

name: Create Release
on:
workflow_dispatch:
inputs:
versionName:
description: 'Semantic Version Number (i.e., 5.5.0 or patch, minor, major, prepatch, preminor, premajor, prerelease)'
required: true
default: patch
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
ref: prod
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }}
- name: Reset prod branch
run: |
git fetch origin main:main
git reset --hard main
git config --global user.email delphibot@example.com
git config --global user.name "Delphi Deploy Bot"
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install bump2version
run: python -m pip install bump2version
- name: Check for delphi-utils changes
uses: dorny/paths-filter@v2
id: changes
with:
base: 'prod'
ref: 'main'
filters: |
utils:
- '_delphi_utils_python/**'
- name: Bump delphi-utils version
id: utils-changed
if: steps.changes.outputs.utils == 'true'
working-directory: ./_delphi_utils_python
run: |
echo -n "::set-output name=version::"
bump2version --list ${{ github.event.inputs.versionName }} | grep ^new_version | sed -r s,"^.*=",,
echo -e "\n::set-output name=msg::(*new*)"
- name: Detect delphi-utils version
id: utils-unchanged
if: steps.changes.outputs.utils == 'false'
working-directory: ./_delphi_utils_python
run: |
echo -n "::set-output name=version::"
bump2version --list -n ${{ github.event.inputs.versionName }} | grep ^current_version | sed -r s,"^.*=",,
echo -e "\n::set-output name=msg::(same as it was)"
- name: Bump covidcast-indicators version
id: indicators
run: |
echo -n "::set-output name=version::"
bump2version --list ${{ github.event.inputs.versionName }} | grep ^new_version | sed -r s,"^.*=",,
- name: Copy version to indicator directory
run: |
indicator_list=("changehc" "claims_hosp" "doctor_visits" "google_symptoms" "hhs_hosp" "nchs_mortality" "quidel_covidtest" "sir_complainsalot")
for path in ${indicator_list[@]}; do
echo "current_version = ${{ steps.indicators.outputs.version }}" > $path/version.cfg
done
- name: Create pull request into prod
uses: peter-evans/create-pull-request@v3
with:
branch: release/indicators_v${{ steps.indicators.outputs.version }}_utils_v${{ steps.utils-changed.outputs.version }}${{ steps.utils-unchanged.outputs.version }}
base: prod
title: Release covidcast-indicators ${{ steps.indicators.outputs.version }}
labels: chore
reviewers: melange396
assignees: melange396
body: |
Releasing:
* covidcast-indicators ${{ steps.indicators.outputs.version }}
* delphi-utils ${{ steps.utils-changed.outputs.version }}${{ steps.utils-unchanged.outputs.version }} ${{steps.utils-changed.outputs.msg }}${{ steps.utils-unchanged.outputs.msg }}