-
Notifications
You must be signed in to change notification settings - Fork 11
103 lines (90 loc) · 2.81 KB
/
dispatch_release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: "[Dispatch] Release"
on:
workflow_dispatch:
inputs:
version:
description: 'enter version(x.y.z)'
required: true
default: '2.0.0'
env:
VERSION: ${{ github.event.inputs.version }}
PACKAGE_VERSION: ${{ github.event.inputs.version }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
BRANCH_NAME: ${{ github.ref_name }}
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: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
packages-dir: dist/python/dist/
- name: Push artifacts to ${{ env.BRANCH_NAME }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
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