-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (111 loc) · 4.58 KB
/
build.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
122
123
124
125
126
127
128
129
130
on:
push:
branches:
- master
schedule:
- cron: '0 1 * * *'
name: Checkout and Create Release Version
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: check Code
uses: actions/checkout@v4
- name: Check Version
run: |
version=$(curl -s 'https://api.github.com/repos/dataease/dataease/releases/latest' | jq -r ".tag_name")
echo "version=${version}" >> $GITHUB_ENV
- name: Check Release
run: |
if gh release view ${{ env.version }} -R ${{ github.repository }} | grep dataease-${{ env.version }}.tar.gz; then
echo "Release already exists"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Tag
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a ${{ env.version }} -m "Release ${{ env.version }}"
git push origin ${{ env.version }} || echo "Tag already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
run: |
gh release create ${{ env.version }} -R ${{ github.repository }} --title "Release ${{ env.version }}" --notes "Release ${{ env.version }}" || echo "Release already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
needs: check
runs-on: ubuntu-latest
steps:
- name: Check Version
run: |
version=$(curl -s 'https://api.github.com/repos/dataease/dataease/releases/latest' | jq -r ".tag_name")
echo "version=${version}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v3
with:
repository: 'dataease/dataease'
ref: ${{ steps.get-version.outputs.version }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '16.15.0'
- name: Set up OpenJDK
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jre-headless
java -version
- name: Build Web
run: |
mvn clean install
cd core && mvn clean package -Pstandalone -U -Dmaven.test.skip=true
- name: Create File
run: |
mkdir -p opt/apps opt/dataease2.0/drivers opt/dataease2.0/cache opt/dataease2.0/data/map opt/dataease2.0/data/static-resource opt/dataease2.0/data/appearance
cp -rf drivers/* opt/dataease2.0/drivers/
cp -rf mapFiles/* opt/dataease2.0/data/map/
cp -rf staticResource/* opt/dataease2.0/data/static-resource/
cp -f core/core-backend/target/CoreApplication.jar opt/apps/app.jar
mv opt dataease-${{ env.version }}
tar -czf dataease-${{ env.version }}.tar.gz dataease-${{ env.version }}
sha256sum dataease-${{ env.version }}.tar.gz > dataease-${{ env.version }}.tar.gz.sha256
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Get Dockerfile
run: |
wget -O Dockerfile.release https://github.com/wojiushixiaobai/dataease/raw/master/Dockerfile
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Image
uses: docker/build-push-action@v5
with:
context: .
provenance: false
file: Dockerfile.release
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: |
${{ github.repository_owner }}/dataease:${{ env.version }}
${{ github.repository_owner }}/dataease:latest
ghcr.io/${{ github.repository_owner }}/dataease:${{ env.version }}
ghcr.io/${{ github.repository_owner }}/dataease:latest
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload Release Asset
run: |
gh release upload ${{ env.version }} dataease-${{ env.version }}.tar.gz dataease-${{ env.version }}.tar.gz.sha256 -R ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}