-
Notifications
You must be signed in to change notification settings - Fork 38
81 lines (64 loc) · 2.61 KB
/
release_on_pr.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
name: Release on PR Merge
on: deployment
jobs:
deploy:
if: github.event.deployment.environment == 'production'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
CI: true
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- name: Setup git
run: |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
- name: Build artifacts
run: |
pip install -r requirements.txt
python build.py --dist
- name: release
run: |
if [ -z "$version" ]; then
version=$(cd bin && ls gauge-python* | head -1 | sed "s/\.[^\.]*$//" | sed "s/gauge-python-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//");
fi
echo "VERSION=$version" >> $GITHUB_ENV
echo "---------------------------"
echo "Updating release v$version"
echo "---------------------------"
echo -e "Gauge Python v$version\n\n" > desc.txt
release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" getgauge gauge-python)
echo "$release_description" >> desc.txt
echo "Creating new draft for release v$version"
gh release create --title "Gauge Python v${version}" --notes-file ./desc.txt "v${version}" bin/*
- name: 'deployment success'
if: success()
uses: 'deliverybot/deployment-status@v1'
with:
state: 'success'
token: '${{ secrets.GITHUB_TOKEN }}'
- name: 'deployment failure'
if: failure()
uses: 'deliverybot/deployment-status@v1'
with:
state: 'failure'
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Upload PyPi package
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload --non-interactive dist/getgauge*
- name: Update metadata in gauge-repository
run: |
git clone https://github.com/getgauge/gauge-repository.git
cd gauge-repository
python update_metadata.py python $VERSION
commit_message=$(echo -e "Update python to v$VERSION")
git add python-install.json
git commit -m "$commit_message"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/getgauge/gauge-repository.git" master