forked from ballerina-platform/ballerina-distribution
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (100 loc) · 4.57 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
91
92
93
94
95
96
97
98
99
100
101
102
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: |
SHORT_VERSION=$((grep -w 'shortVersion' | cut -d= -f2) < gradle.properties)
RELEASE_VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
echo VERSION=$RELEASE_VERSION >> $GITHUB_ENV
echo "::set-output name=version::$RELEASE_VERSION"
echo "::set-output name=sversion::$SHORT_VERSION"
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- 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 }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
run: |
./gradlew build release -Prelease.useAutomaticVersion=true -Pversion=${VERSION}
- 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-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload zip without tool 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-${{ steps.version-set.outputs.sversion }}.zip
asset_path: ballerina/build/distributions/ballerina-${{ steps.version-set.outputs.sversion }}.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-linux-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/build/distributions/ballerina-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-macos-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/build/distributions/ballerina-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-windows-${{ steps.version-set.outputs.version }}.zip
asset_path: ballerina/build/distributions/ballerina-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"