Skip to content

Commit e999870

Browse files
authored
Merge pull request #6 from qianmoQ/feature-dev
发布 1.5.0
2 parents 1afbd5b + 7af621b commit e999870

File tree

15 files changed

+181
-16
lines changed

15 files changed

+181
-16
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Publish images via Docker
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
env:
8+
APP_NAME: infosphere
9+
GITHUB_REGISTRY: ghcr.io
10+
APP_GITHUB_GROUP: devlive-community
11+
APP_DOCKER_GROUP: devliveorg
12+
13+
jobs:
14+
before-compile:
15+
runs-on: ubuntu-latest
16+
17+
outputs:
18+
APP_VERSION: ${{ steps.apply_version.outputs.APP_VERSION }}
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Setup java
25+
uses: actions/setup-java@v3
26+
with:
27+
java-version: '11'
28+
distribution: 'temurin'
29+
30+
- name: Generate app version
31+
run: echo APP_VERSION=`./mvnw -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.help=INFO | tail -1` >> "$GITHUB_OUTPUT"
32+
id: apply_version
33+
34+
- name: Compile from source
35+
run: |
36+
chmod 755 ./mvnw
37+
./mvnw clean install package -Dfindbugs.skip -Dgpg.skip -Dcheckstyle.skip -DskipTests=true -q
38+
39+
- name: Cache binary
40+
id: cache-binary
41+
uses: actions/cache@v3
42+
env:
43+
cache-name: cache-binary
44+
with:
45+
path: |
46+
./Dockerfile
47+
./dist/infosphere-release.tar.gz
48+
key: ${{ runner.os }}-build-${{ env.cache-name }}
49+
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
50+
51+
publish-github-ghcr:
52+
runs-on: ubuntu-latest
53+
needs:
54+
- before-compile
55+
steps:
56+
- name: Get cache binary
57+
id: cache-binary
58+
uses: actions/cache@v3
59+
env:
60+
cache-name: cache-binary
61+
with:
62+
path: |
63+
./Dockerfile
64+
./dist/infosphere-release.tar.gz
65+
key: ${{ runner.os }}-build-${{ env.cache-name }}
66+
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
67+
68+
- name: Set up QEMU
69+
uses: docker/setup-qemu-action@v1
70+
71+
- name: Set up Docker Build
72+
uses: docker/setup-buildx-action@v1
73+
74+
- name: Login
75+
uses: docker/login-action@v1
76+
with:
77+
registry: ${{ env.GITHUB_REGISTRY }}
78+
username: qianmoq
79+
password: ${{ secrets.PACKAGES_TOKEN }}
80+
81+
- name: Build and push
82+
uses: docker/build-push-action@v2
83+
with:
84+
context: .
85+
push: true
86+
tags: |
87+
${{ env.GITHUB_REGISTRY }}/${{ env.APP_GITHUB_GROUP }}/${{ env.APP_NAME }}:${{ needs.before-compile.outputs.APP_VERSION }}
88+
${{ env.GITHUB_REGISTRY }}/${{ env.APP_GITHUB_GROUP }}/${{ env.APP_NAME }}:latest
89+
90+
publish-docker-hub:
91+
runs-on: ubuntu-latest
92+
needs:
93+
- before-compile
94+
steps:
95+
- name: Get cache binary
96+
id: cache-binary
97+
uses: actions/cache@v3
98+
env:
99+
cache-name: cache-binary
100+
with:
101+
path: |
102+
./Dockerfile
103+
./dist/infosphere-release.tar.gz
104+
key: ${{ runner.os }}-build-${{ env.cache-name }}
105+
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
106+
107+
- name: Set up QEMU
108+
uses: docker/setup-qemu-action@v1
109+
110+
- name: Set up Docker Build
111+
uses: docker/setup-buildx-action@v1
112+
113+
- name: Login to DockerHub
114+
uses: docker/login-action@v1
115+
with:
116+
username: ${{ secrets.ORG_DOCKERHUB_USERNAME }}
117+
password: ${{ secrets.ORG_DOCKERHUB_TOKEN }}
118+
119+
- name: Build and push
120+
uses: docker/build-push-action@v2
121+
with:
122+
context: .
123+
push: true
124+
tags: |
125+
${{ env.APP_DOCKER_GROUP }}/${{ env.APP_NAME }}:${{ needs.before-compile.outputs.APP_VERSION }}
126+
${{ env.APP_DOCKER_GROUP }}/${{ env.APP_NAME }}:latest

configure/initializer/infosphere.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ CREATE TABLE `infosphere_role`
1010
`update_time` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间'
1111
) COMMENT '用户路由表';
1212

13-
INSERT INTO `infosphere_role`(`code`, `name`, `description`)
14-
VALUES ('8b80291d-6f7f-e239-005b-faeef22088d8', 'USER', 'User Role - 拥有普通用户权限'),
15-
('151b9c43-6385-85e2-fe33-6a720b4c570b', 'ADMIN', 'Admin Role - 拥有平台所有权限');
13+
INSERT INTO `infosphere_role`(`id`, `code`, `name`, `description`)
14+
VALUES (1, '8b80291d-6f7f-e239-005b-faeef22088d8', 'USER', 'User Role - 拥有普通用户权限'),
15+
(2, '151b9c43-6385-85e2-fe33-6a720b4c570b', 'ADMIN', 'Admin Role - 拥有平台所有权限');
1616

1717
CREATE TABLE `infosphere_user`
1818
(
@@ -31,13 +31,18 @@ CREATE TABLE `infosphere_user`
3131

3232
INSERT INTO `infosphere_user` (`id`, `username`, `password`, `avatar`, `alias_name`, `signature`, `email`, `active`, `locked`)
3333
VALUES (1, 'Anonymous User', null, '/static/images/anonymous.png', 'Anonymous User', '我是系统匿名用户用于底层默认用户', 'anonymous@devlive.org', 0, 1);
34+
INSERT INTO `infosphere_user` (`id`, `username`, `password`, `avatar`, `alias_name`, `signature`, `email`, `active`, `locked`)
35+
VALUES (2, 'infosphere', '$2a$10$FsBJlTOyjqKmK9iFuRuSTub0pvO2h8amcIock.r8Pl9KMuCsScB8S', null, 'infosphere', null, 'infosphere@devlive.org', 0, 0);
3436

3537
CREATE TABLE `infosphere_user_role_relation`
3638
(
3739
`user_id` BIGINT(20),
3840
`role_id` BIGINT(20)
3941
) COMMENT '用户与路由关系表';
4042

43+
INSERT INTO `infosphere_user_role_relation` (`user_id`, `role_id`)
44+
VALUES (2, 1);
45+
4146
CREATE TABLE `infosphere_article`
4247
(
4348
`id` BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,

core/infosphere-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.devlive.infosphere</groupId>
66
<artifactId>infosphere</artifactId>
7-
<version>1.5.0-SNAPSHOT</version>
7+
<version>1.5.0</version>
88
<relativePath>../../pom.xml</relativePath>
99
</parent>
1010

core/infosphere-security/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.devlive.infosphere</groupId>
66
<artifactId>infosphere</artifactId>
7-
<version>1.5.0-SNAPSHOT</version>
7+
<version>1.5.0</version>
88
<relativePath>../../pom.xml</relativePath>
99
</parent>
1010

core/infosphere-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.devlive.infosphere</groupId>
66
<artifactId>infosphere</artifactId>
7-
<version>1.5.0-SNAPSHOT</version>
7+
<version>1.5.0</version>
88
<relativePath>../../pom.xml</relativePath>
99
</parent>
1010

core/infosphere-server/src/main/resources/viewer/layout/article/article-description.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<!-- 操作功能 -->
1414
<div class="col-md-4 text-right">
15-
<a class="btn btn-link btn-xs" th:target="_blank" th:href="@{'/viewer/article/' + ${details.code} + '/edit'}">修改</a>
15+
<a th:if="${session.SPRING_SECURITY_CONTEXT}" class="btn btn-link btn-xs" th:target="_blank" th:href="@{'/viewer/article/' + ${details.code} + '/edit'}">修改</a>
1616
</div>
1717
</div>
1818
</div>

core/infosphere-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.devlive.infosphere</groupId>
66
<artifactId>infosphere</artifactId>
7-
<version>1.5.0-SNAPSHOT</version>
7+
<version>1.5.0</version>
88
<relativePath>../../pom.xml</relativePath>
99
</parent>
1010

core/infosphere-service/src/main/java/org/devlive/infosphere/service/repository/ArticleRepository.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ public interface ArticleRepository
2020
"ORDER BY e.createTime DESC")
2121
Page<ArticleEntity> findAllOrderByCreateTimeDesc(Pageable pageable);
2222

23+
@Query(value = "SELECT e " +
24+
"FROM ArticleEntity e " +
25+
"WHERE e.published = true " +
26+
"ORDER BY e.viewCount DESC")
27+
Page<ArticleEntity> findAllOrderByViewCountDesc(Pageable pageable);
28+
2329
@Query(value = "SELECT e " +
2430
"FROM ArticleEntity e " +
2531
"WHERE e.user = :user " +

core/infosphere-service/src/main/java/org/devlive/infosphere/service/service/impl/ArticleServiceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public CommonResponse<PageAdapter<ArticleEntity>> findAll(String action, Pageabl
5656
if (action.equals("forme")) {
5757
return CommonResponse.success(PageAdapter.of(repository.findAllByUserOrderByCreateTimeDesc(UserDetailsService.getUser(), pageable)));
5858
}
59+
else if (action.equals("hottest")) {
60+
return CommonResponse.success(PageAdapter.of(repository.findAllOrderByViewCountDesc(pageable)));
61+
}
5962
else {
6063
return CommonResponse.success(PageAdapter.of(repository.findAllOrderByCreateTimeDesc(pageable)));
6164
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
- ./configure/initializer/infosphere.sql:/docker-entrypoint-initdb.d/schema.sql
1313

1414
infosphere-app:
15-
image: devlive-community/infosphere:latest
15+
image: devliveorg/infosphere:latest
1616
environment:
1717
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/infosphere
1818
SPRING_DATASOURCE_USERNAME: root

0 commit comments

Comments
 (0)