78 lines (67 loc) · 2.67 KB
/
deploy.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
name: Release on PR Merge
on: deployment
jobs:
release-and-bump-version:
if: github.event.deployment.environment == 'production'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
steps:
- uses: actions/checkout@v1
- uses: geertvdc/setup-hub@master
- name: Setup go 1.13.1
uses: actions/setup-go@v1
with:
go-version: 1.13.1
- name: build
run: |
go run build/make.go --all-platforms
go run build/make.go --all-platforms --distro
- 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: Deploy
run: |
cd deploy
if [ -z "$version" ]; then
version=$(ls html-report* | head -1 | sed "s/\.[^\.]*$//" | sed "s/html-report-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//");
fi
echo "::set-env name=VERSION::$version"
artifacts=()
dir=`pwd`
for i in `ls`; do
artifacts+="$dir/$i "
done
cd ..
echo "---------------------------"
echo "Updating release v$version"
echo "---------------------------"
echo -e "HTML Report 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 html-report)
echo "$release_description" >> desc.txt
echo "Creating new draft for release v$version"
hub release create -F ./desc.txt "v$version"
rm -rf desc.txt
echo "Start uploading assets..."
for i in `ls $artifacts`; do
hub release edit -m "" -a $i "v$version"
if [ $? -ne 0 ];then
exit 1
fi
done
- name: Update metadata in gauge-repository
run: |
git clone https://github.com/getgauge/gauge-repository.git
cd gauge-repository
python update_metadata.py js $VERSION
commit_message=$(echo -e "Update js to v$VERSION")
git commit -am "$commit_message"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/getgauge/gauge-repository.git" master
- name: Bump up version
run: |
git clean -dfx
git checkout master && git checkout . && git pull --rebase
version=$(python update_version.py)
git commit -am "Bumping up -> $version"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" master