-
Notifications
You must be signed in to change notification settings - Fork 13
121 lines (120 loc) · 4.46 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
name: Release nio
on:
workflow_dispatch:
inputs:
lastVersion:
description: 'last version'
required: true
releaseVersion:
description: 'release version'
required: true
nextVersion:
description: 'next version'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.2.0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '14'
- name: build manual
id: manual
run: |
sh ./scripts/build.sh manual
echo "::set-output name=diff::$(git diff --numstat | wc -l)"
- name: Commit manual
if: steps.manual.outputs.diff != '0'
run: |
git config --local user.email "nio-github-actions@users.noreply.github.com"
git config --local user.name "nio-github-actions"
git add --all
git commit -am "Update documentation before release"
- name: Push manual
uses: ad-m/github-push-action@master
if: steps.manual.outputs.diff != '0'
with:
branch: master
github_token: ${{ secrets.GITHUB_TOKEN}}
# release sbt (with auto commit tag)
- name: release sbt
run: |
git config --local user.email "nio-github-actions@users.noreply.github.com"
git config --local user.name "nio-github-actions"
sbt "release with-defaults release-version ${{ github.event.inputs.releaseVersion }} next-version ${{ github.event.inputs.nextVersion }}"
- name: push tag
uses: ad-m/github-push-action@master
with:
branch: master
tags: true
github_token: ${{ secrets.GITHUB_TOKEN}}
# clean, build doc and build Nio
- name: Build Nio
run: sh ./scripts/build.sh github
# create github release
- name: Create a Release
id: create_release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.releaseversion }}
release_name: v${{ github.event.inputs.releaseversion }}
draft: false
# attach nio.jar, zip & manual.zip to github release
- name: Upload a Release Asset - nio.jar
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nio-server/target/scala-2.13/nio.jar
asset_name: nio.jar
asset_content_type: application/octet-stream
- name: Upload a Release Asset - nio.zip
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nio-server/target/universal/nio-dist.zip
asset_name: nio-${{ github.event.inputs.releaseversion }}.zip
asset_content_type: application/octet-stream
- name: Zip manual
run: zip -r ./nio-manual.zip ./docs/manual -x '*.DS_Store'
- name: Upload a Release Asset - manual
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nio-manual.zip
asset_name: nio-manual-${{ github.event.inputs.releaseversion }}.zip
asset_content_type: application/octet-stream
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
# build docker image & upload it in docker hub
- name: Build docker image
run: |
cd nio
sbt 'docker:publishLocal'
docker tag maif/nio:latest maif/nio:${{ github.event.inputs.releaseversion }}
docker push "maif/nio:latest"
docker push "maif/nio:${{ github.event.inputs.releaseversion }}"
# close milestone (with the latest release found)
- name: Close milestone
uses: adlerhsieh/prepare-release@0.1.2
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
REPO_OWNER: ${{ github.repository_owner }}
REPO: nio
IGNORE_MILESTONE_NOT_FOUND: true