Nightly Build #424
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: Nightly Build | |
on: | |
schedule: | |
- cron: '0 18 * * 0,1,2,3,4' # run at 2 AM (UTC + 8) every working day | |
workflow_dispatch: | |
branches: | |
- main | |
inputs: | |
alpha_version: | |
description: 'Alpha version serial number' | |
required: true | |
type: number | |
default: '0' | |
jobs: | |
build-nightly-release: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # fetch all the code, we need the full log history for shortcut integration | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Release to PyPi | |
id: release_pypi | |
run: | | |
# remove tracking config for nightly build | |
echo "" > ./piperider_cli/data/CONFIG | |
# generate pypirc | |
echo "$PYPIRC" > $HOME/.pypirc | |
# change package name to piperider-nightly | |
sed -i.bak "s/name='piperider'/name='piperider-nightly'/" setup.py | |
# update version number | |
echo "Nightly build version: $(date '+%Y%m%d')" | |
if [ "$ALPHA_VERSION" != "" ]; then | |
echo "Manually alpha version serial number: $ALPHA_VERSION" | |
sed -i.bak "s/\.dev\$/\.$(date '+%Y%m%d')a$ALPHA_VERSION/" piperider_cli/VERSION | |
else | |
sed -i.bak "s/\.dev\$/\.$(date '+%Y%m%d')/" piperider_cli/VERSION | |
fi | |
echo "Nightly build version: $(cat piperider_cli/VERSION)" | |
echo "::set-output name=nightly_version::$(cat piperider_cli/VERSION)" | |
# add commit sha to version command | |
echo "$GITHUB_SHA" > piperider_cli/data/COMMIT | |
# put config includes tracking api key | |
echo "$CONFIG" > ./piperider_cli/data/CONFIG | |
# release to PyPI | |
make release | |
env: | |
PYPIRC: ${{ secrets.PYPI_NIGHTLY }} | |
CONFIG: ${{ secrets.DEV_CONFIG }} | |
ALPHA_VERSION: ${{ inputs.alpha_version || '' }} | |
- name: Mark Sentry Release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: infuseai | |
SENTRY_PROJECT: piperider | |
with: | |
environment: nightly | |
ignore_empty: true | |
ignore_missing: true | |
version: ${{ steps.release_pypi.outputs.nightly_version }} | |
- name: Notify Release to Slack and Update Shortcut Stories | |
run: | | |
if [ "$ALPHA_VERSION" != '' ]; then | |
echo "[Skip] Notify release to Slack and Update Shortcut Stories" | |
echo "PipeRider Alpha version: $(cat piperider_cli/VERSION)" | |
else | |
echo "Notify release to Slack and Update Shortcut Stories" | |
echo "PipeRider version: $(cat piperider_cli/VERSION)" | |
bash .github/scripts/deploy_notify.sh $(cat piperider_cli/VERSION) | |
fi | |
env: | |
ALPHA_VERSION: ${{ inputs.alpha_version || '' }} | |
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }} | |
SHORTCUT_API_TOKEN: ${{ secrets.SHORTCUT_API_TOKEN }} | |
SLACK_CHANNEL: '#dev' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Mark Amplitude Release | |
run: | | |
if [ "$ALPHA_VERSION" != '' ]; then | |
echo "[Skip] Mark Amplitude Release" | |
else | |
bash .github/scripts/bump_amplitude_release.sh $VERSION | |
fi | |
env: | |
ALPHA_VERSION: ${{ inputs.alpha_version || '' }} | |
VERSION: ${{ steps.release_pypi.outputs.nightly_version }} | |
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_DEV_API_KEY }} | |
AMPLITUDE_SECRET_KEY: ${{ secrets.AMPLITUDE_DEV_SECRET_KEY }} |