-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (111 loc) · 3.5 KB
/
release-publish.yml
File metadata and controls
134 lines (111 loc) · 3.5 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
# 1. Update changelog
# 2. Build the exe file and upload it in the release assets
# 3. Deploy the latest release to demo.fosslight.org
# 4. Deploy Image to Docker Hub
name: Release FOSSLight
on:
release:
types: [ published ]
jobs:
update-changelog:
runs-on: ubuntu-latest
strategy:
matrix:
ref: [ main, develop ]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.ref }}
- name: update changelog with gren
env:
GREN_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm install github-release-notes@0.17.3
node_modules/.bin/gren changelog --override
- name: Commit files
run: |
git config --global user.email "fosslight-dev@lge.com"
git config --global user.name "FOSSLight-dev"
git add CHANGELOG.md
git commit -m "Update ChangeLog on ${{ matrix.ref }} branch"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ matrix.ref }}
build:
needs: update-changelog
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --exclude-task test
- name: Rename package
run: mv build/libs/FOSSLight*.war FOSSLight.war
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./FOSSLight.war
asset_name: FOSSLight.war
asset_content_type: application/octet-stream
deploy-demo:
needs: build
runs-on: ubuntu-latest
steps:
- name: Sleep for 30 seconds
uses: jakejarvis/wait-action@master
with:
time: '30s'
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_SSH_ID }}
key: ${{ secrets.REMOTE_SSH_KEY }}
port: ${{ secrets.REMOTE_SSH_PORT }}
script: |
cd /service/deploy/fosslight/
bash /service/deploy/fosslight/deploy.sh
deploy-image:
needs: deploy-demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: |
linux/arm64/v8
linux/arm/v7
linux/ppc64le
linux/s390x
linux/amd64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/fosslight:latest
${{ secrets.DOCKERHUB_USERNAME }}/fosslight:${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max