[Dispatch] Release #39
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: "[Dispatch] Release" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'enter version(x.y.z)' | |
required: true | |
default: '1.0.0' | |
env: | |
VERSION: ${{ github.event.inputs.version }} | |
PACKAGE_VERSION: ${{ github.event.inputs.version }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Set python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Make all and Packaging | |
run: | | |
make clean | |
make all | |
sudo chmod -R 777 dist | |
cd dist/python | |
python setup.py sdist bdist_wheel | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: ${{ secrets.PYPI_USERNAME }} | |
password: ${{ secrets.PYPI_PASSWORD }} | |
verbose: true | |
packages-dir: dist/python/dist/ | |
- name: Push artifacts to origin master | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
branch: master | |
commit_message: "[CI] api has been built" | |
commit_user_name: cloudforet-admin | |
commit_user_email: [email protected] | |
commit_author: cloudforet-admin <[email protected]> | |
push_options: '--force' | |
tagging_message: ${{ env.VERSION }} | |
- name: Push json to api-doc repository | |
uses: andstor/copycat-action@v3 | |
with: | |
personal_token: ${{ secrets.PAT_TOKEN }} | |
src_path: dist/json/. | |
dst_path: dist/json/. | |
dst_owner: cloudforet-io | |
dst_repo_name: api-doc | |
- name: Notice when job fails | |
if: failure() | |
uses: 8398a7/[email protected] | |
with: | |
status: ${{job.status}} | |
fields: repo,workflow,job | |
author_name: Github Action Slack | |
trigger_api_doc_release: | |
needs: build_and_push | |
runs-on: ubuntu-latest | |
steps: | |
- name: task | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
repo: cloudforet-io/api-doc | |
workflow: dispatch_release.yaml | |
ref: master | |
inputs: '{"version": "${{ env.VERSION }}"}' | |
notification: | |
needs: build_and_push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack | |
if: always() | |
uses: 8398a7/[email protected] | |
with: | |
status: ${{job.status}} | |
fields: repo,message,commit,author,action,ref,workflow,job | |
author_name: Github Action Slack |