-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (124 loc) · 4.37 KB
/
release.yml
File metadata and controls
143 lines (124 loc) · 4.37 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
135
136
137
138
139
140
141
142
143
# @Github: https://github.com/Certseeds/algorithm-template-java
# @Organization: SUSTech
# @Author: nanoseeds
# @Date: 2020-07-28 22:43:03
# @LastEditors: nanoseeds
#@LastEditTime: 2020-07-28 23:43:03
# This is a basic workflow to help you get started with Actions
name: publish release
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
tags:
- "*"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: test for release
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v5
- name: Setup Java JDK
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: unix-like clean build test
run: mvn clean compile test -T 1C
# This workflow contains a single job called "build"
build:
name: publish release
if: github.repository == 'Certseeds/algorithm-template-java'
needs: test
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v5
- name: Setup Java JDK
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Branch name
id: branch_name
run: |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: tag name output
run: |
echo ${SOURCE_NAME};echo ${SOURCE_BRANCH};echo ${SOURCE_TAG}
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
- name: Use java and javac
run: javac --version; java --version
- name: run script
run: |
chmod +x ./generate.sh
./generate.sh
mv ./producer.jar /tmp/producer.jar
- name: zip the packet
working-directory: ./../
run: |
echo $(pwd)
zip -r script_no_need.zip ./algorithm-template-java -x "*/.git/*"
echo $(pwd)
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./../script_no_need.zip
prerelease: false
generate_release_notes: true
- name: tree
run: tree
release-branch:
name: publish release-branch
if: github.repository == 'Certseeds/algorithm-template-java'
needs: [ test, build ]
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v5
- name: Branch name
id: branch_name
run: |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: tag name output
run: |
echo ${SOURCE_NAME};
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
- name: git operations
run: |
git config --global user.name 'Certseeds'
git config --global user.email '51754303+Certseeds@users.noreply.github.com'
git checkout -b release
- name: run script
run: |
chmod +x ./generate.sh
./generate.sh
mv ./producer.jar /tmp/producer.jar
- name: git operations
working-directory: ./
run: |
git add .
git commit -am "release ${{ steps.branch_name.outputs.SOURCE_NAME }}"
git push --set-upstream origin release --force