-
Notifications
You must be signed in to change notification settings - Fork 29
90 lines (88 loc) · 3.86 KB
/
publish-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
name: Publish release
on:
workflow_dispatch:
jobs:
publish-release:
name: Publish Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set version env variable
id: version-set
run: |
RELEASE_VERSION=$(./gradlew properties | grep ^version: | cut -d\ -f2 | sed 's@-SNAPSHOT@@')
echo VERSION=$RELEASE_VERSION >> $GITHUB_ENV
echo "::set-output name=version::$RELEASE_VERSION"
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Pre release depenency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git checkout -b release-${VERSION}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew release -Prelease.useAutomaticVersion=true
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
tag_name: "v${{ steps.version-set.outputs.version }}"
release_name: ${{ steps.version-set.outputs.version }}
draft: false
prerelease: false
- name: Upload zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-command-${{ steps.version-set.outputs.version }}.zip
asset_path: build/distributions/ballerina-command-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload Linux zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-command-linux-${{ steps.version-set.outputs.version }}.zip
asset_path: build/distributions/ballerina-command-linux-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload MacOS zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-command-macos-${{ steps.version-set.outputs.version }}.zip
asset_path: build/distributions/ballerina-command-macos-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload Windows zip artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ballerina-command-windows-${{ steps.version-set.outputs.version }}.zip
asset_path: build/distributions/ballerina-command-windows-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Post release PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
bin/hub pull-request -m "[Automated] Sync master after "$VERSION" release"