Skip to content

Commit

Permalink
feat: enahnce ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
teletha committed Jan 9, 2024
1 parent 43e1e91 commit eb27277
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/main/java/bee/task/CI.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ public void github() {
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: %s
- name: Build artifact and site
run: |
if [ -e "bee" ]; then
source bee install doc:site
source bee install doc:site maven:pom ci:readme ci:license
else
version=$(curl -SsL https://git.io/stable-bee)
curl -SsL -o bee-${version}.jar https://jitpack.io/com/github/teletha/bee/${version}/bee-${version}.jar
java -javaagent:bee-${version}.jar -cp bee-${version}.jar bee.Bee install doc:site
java -javaagent:bee-${version}.jar -cp bee-${version}.jar bee.Bee install doc:site maven:pom ci:readme ci:license
fi
- name: Deploy site
Expand All @@ -88,10 +88,15 @@ public void github() {
publish_dir: target/site
- name: Request Releasing
uses: GoogleCloudPlatform/release-please-action@v3
uses: GoogleCloudPlatform/release-please-action@v4
with:
release-type: simple
package-name: %s
- name: Auto commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: update repository info
""";

String version = Inputs.normalize(project.getJavaSourceVersion());
Expand All @@ -100,8 +105,8 @@ public void github() {
// so we will adjust it.
makeFile("version.txt", List.of(project.getVersion(), "")).text(o -> o.replaceAll("\\R", "\n"));
makeFile(".github/workflows/build.yml", String.format(build, version, project.getProduct()));
makeLicenseFile();
makeReadMeFile();
license();
readme();

// delete old settings
deleteFile(".github/workflows/java-ci-with-maven.yml");
Expand All @@ -111,7 +116,8 @@ public void github() {
/**
* Create license file if needed
*/
private void makeLicenseFile() {
@Command("Generate license file.")
public void license() {
License license = project.license();

if (license == null) {
Expand All @@ -128,7 +134,8 @@ private void makeLicenseFile() {
/**
* Create README file if needed
*/
private void makeReadMeFile() {
@Command("Generate readme file.")
public void readme() {
List<Snippet> snippets = project.getRoot()
.walkFile("**/ReadMe*Test.java")
.first()
Expand Down

0 comments on commit eb27277

Please sign in to comment.