forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (127 loc) · 4.58 KB
/
release.yml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build Release
on:
# Manual Trigger GH CLI -> gh workflow run release.yml --ref <tag>
workflow_dispatch:
jobs:
run-python-tests:
uses: ./.github/workflows/python-versions.yml
with:
ref: ${{ github.ref_name }}
secrets:
PARAMETER_PASSWORD: ${{ secrets.PARAMETER_PASSWORD }}
run-javascript-tests:
uses: ./.github/workflows/js-tests.yml
with:
ref: ${{ github.ref_name }}
run-py-prod-deps-smoke-test:
uses: ./.github/workflows/py-prod-deps-smoke-test.yml
with:
ref: ${{ github.ref_name }}
run-cypress-tests:
uses: ./.github/workflows/cypress.yml
with:
ref: ${{ github.ref_name }}
build-release:
runs-on: ubuntu-latest
needs: [run-python-tests, run-javascript-tests, run-py-prod-deps-smoke-test, run-cypress-tests]
defaults:
run:
shell: bash --login -eo pipefail {0}
permissions:
# Additional permission needed to generate release
contents: write
steps:
- name: Checkout Streamlit code
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
persist-credentials: false
submodules: 'recursive'
- name: Set Python version vars
uses: ./.github/actions/set_python_versions
- name: Set up Python ${{ env.PYTHON_MAX_VERSION }}
uses: actions/setup-python@v4
with:
python-version: "${{ env.PYTHON_MAX_VERSION }}"
# Uses action to safely process user input (branch name) to prevent script injection attacks
- name: Set GIT_TAG & GH_REPO env variables
uses: ./.github/actions/tag_and_repo
with:
tag_name: ${{ github.ref_name }}
repo: ${{ github.repository }}
- name: Look up the related GitHub PR branch name
# Need GH Token to use gh api
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install requests
echo "GH_PR_BRANCH=$(python scripts/get_release_branch.py)" >> $GITHUB_ENV
- name: Ensure that version tag matches branch version
env:
GH_PR_BRANCH: ${{ env.GH_PR_BRANCH }}
run: |
BRANCH_VERSION=$(echo "$GH_PR_BRANCH" | sed 's/release\///' )
if [ "$BRANCH_VERSION" != "$GIT_TAG" ]
then
echo "ERROR: Version number from tag does not match the version number from the branch name."
exit 1
fi
- name: Checkout head of branch
env:
GH_PR_BRANCH: ${{ env.GH_PR_BRANCH }}
run: |
git pull origin "$GH_PR_BRANCH" --ff-only
- name: Setup virtual env
uses: ./.github/actions/make_init
- name: Set release version from tag name
env:
GIT_TAG: ${{ env.GIT_TAG }}
run: echo "STREAMLIT_RELEASE_VERSION=$GIT_TAG" >> $GITHUB_ENV
- name: Update version
env:
STREAMLIT_RELEASE_VERSION: ${{ env.STREAMLIT_RELEASE_VERSION }}
run: |
python scripts/update_version.py "$STREAMLIT_RELEASE_VERSION"
- name: Create Package
timeout-minutes: 120
run: |
sudo apt install rsync
make package
- name: Store Package
uses: actions/upload-artifact@v3
with:
name: Release
path: lib/dist
- name: Upload to PyPI
env:
TWINE_USERNAME: ${{ secrets.STREAMLIT_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.STREAMLIT_PYPI_API_TOKEN }}
run: |
make distribute
- name: Commit version updates
env:
GH_PR_BRANCH: ${{ env.GH_PR_BRANCH }}
STREAMLIT_RELEASE_VERSION: ${{ env.STREAMLIT_RELEASE_VERSION }}
run: |
git config user.email "core+streamlitbot-github@streamlit.io"
git config user.name "Streamlit Bot"
git switch -c "$GH_PR_BRANCH"
git commit -am 'Up version to "$STREAMLIT_RELEASE_VERSION"' && git push origin "$GH_PR_BRANCH" || echo "No changes to commit"
- name: Create GitHub Release
env:
GIT_TAG: ${{ env.GIT_TAG }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python scripts/create_release.py
- name: Successful Release Slack Message
if: ${{ success() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
RUN_ID: ${{ github.run_id }}
run: python scripts/slack_notifications.py release success
- name: Failed Release Slack Message
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
RUN_ID: ${{ github.run_id }}
run: python scripts/slack_notifications.py release failure