Skip to content

Commit 18cd540

Browse files
committed
add github action job for creating releases
1 parent f1be684 commit 18cd540

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

.github/workflows/verify-and-release.yml

+54-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Verify and Release on tags
1+
name: Verify and Release
22

33
# trigger on push to branches and PR
44
on:
@@ -11,6 +11,10 @@ on:
1111
- 'v[0-9]+.[0-9]+.[0-9]+'
1212
pull_request:
1313

14+
env:
15+
# restore to default url to download maven
16+
MVNW_REPOURL: https://repo.maven.apache.org/maven2
17+
1418
jobs:
1519
lint_shellcheck:
1620
name: shellcheck
@@ -49,9 +53,9 @@ jobs:
4953
distribution: 'temurin'
5054
cache: maven
5155
- name: Lint Maven Pom Format
52-
run: ./mvnw -V -B -ntp sortpom:verify -Dsort.verifyFail=STOP
56+
run: ./mvnw -V -B -ntp -Dmirror.of.proxy= sortpom:verify -Dsort.verifyFail=STOP
5357
- name: Lint Check Maven Plugins
54-
run: ./mvnw -B -ntp artifact:check-buildplan
58+
run: ./mvnw -B -ntp -Dmirror.of.proxy= artifact:check-buildplan
5559

5660
verify:
5761
name: 'Verify with JDK ${{ matrix.jdk }}'
@@ -73,21 +77,33 @@ jobs:
7377
cache: maven
7478

7579
- name: Maven verify
76-
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
77-
run: ./mvnw -B -ntp -e verify
80+
run: ./mvnw -B -ntp -e -Dmirror.of.proxy= verify
7881

79-
- name: Maven verify and check reproducible on tags
80-
if: startsWith(github.ref, 'refs/tags/v')
82+
reproducible:
83+
name: 'Build and check reproducible'
84+
runs-on: ubuntu-latest
85+
if: startsWith(github.ref, 'refs/tags/v')
86+
needs: [ verify ]
87+
steps:
88+
- uses: actions/checkout@v4
89+
- name: Set up JDK
90+
uses: actions/setup-java@v4
91+
with:
92+
java-version: 11
93+
distribution: 'temurin'
94+
cache: maven
95+
96+
- name: Build reproducible artifacts
8197
shell: bash
8298
run: |
8399
set -ux
84-
./mvnw -B -ntp -e install -Dbuildinfo.detect.skip=false
85-
./mvnw -B -ntp -e clean
100+
./mvnw -B -ntp -e -Dmirror.of.proxy= install -Dmaven.test.skip=true -DskipTests -Dinvoker.skip -Dbuildinfo.detect.skip=false
101+
./mvnw -B -ntp -e -Dmirror.of.proxy= clean
86102
mkdir -p target
87103
88104
true artifact:compare should not contain warning or error
89105
trap 'cat target/build.log' ERR
90-
./mvnw -B -ntp -e -l target/build.log package artifact:compare -Dmaven.test.skip=true -DskipTests -Dinvoker.skip -Dbuildinfo.detect.skip=false
106+
./mvnw -B -ntp -e -Dmirror.of.proxy= -l target/build.log package artifact:compare -Dmaven.test.skip=true -DskipTests -Dinvoker.skip -Dbuildinfo.detect.skip=false
91107
92108
test 0 = "$(sed -n '/^\\[INFO\\] --- maven-artifact-plugin:[^:][^:]*:compare/,/^\\[INFO\\] ---/ p' target/build.log | grep -c '^\\[\\(WARNING\\|ERROR\\)\\]')"
93109
@@ -97,3 +113,31 @@ jobs:
97113
trap '' ERR
98114
99115
find . -name "*.buildcompare" -print0 | xargs -0 cat
116+
117+
- name: Store artifacts
118+
uses: actions/upload-artifact@v4
119+
with:
120+
path: core/target/hbox-*-dist.tar.gz
121+
retention-days: 7
122+
123+
create_a_draft_release:
124+
name: Create a draft release
125+
runs-on: ubuntu-latest
126+
if: github.repository == 'Qihoo360/hbox' && startsWith(github.ref, 'refs/tags/v')
127+
needs: [ reproducible ]
128+
permissions:
129+
contents: write
130+
steps:
131+
- name: Download artifacts
132+
uses: actions/download-artifact@v4
133+
with:
134+
merge-multiple: true
135+
path: core/target/
136+
137+
- name: Publish artifacts
138+
uses: softprops/action-gh-release@v2
139+
with:
140+
draft: true
141+
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
142+
fail_on_unmatched_files: true
143+
files: core/target/hbox-*-dist.tar.gz

0 commit comments

Comments
 (0)