Skip to content

Commit

Permalink
Merge pull request #60 from hizumiaoba/develop
Browse files Browse the repository at this point in the history
Switch to main-only branch strategy
  • Loading branch information
hizumiaoba authored May 17, 2024
2 parents 63104bf + 66dbb97 commit 17486de
Show file tree
Hide file tree
Showing 18 changed files with 1,043 additions and 71 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Java CI with Gradle

on:
pull_request:
branches: [ "develop" ]
branches: [ "develop", "main" ]

jobs:
build:
Expand Down Expand Up @@ -41,11 +41,6 @@ jobs:
jpackageImage
-i
--scan
- name: Upload built artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-jpackageImage
path: build/jpackage/MinecraftTimeMachine
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
Expand Down
84 changes: 67 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,43 @@ name: Bump version

on:
push:
branches: [ main ]
tags:
- 'v*'

jobs:

compile:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Grant execution permission for wrapper file
run: chmod +x ./gradlew ./gradlew.bat
- name: Gradle build action
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--scan
--refresh-dependencies
--no-build-cache
--rerun-tasks
release:

# This job needs the compile job so that any compile error prevents generating a redundant release
needs: compile

runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -21,16 +53,38 @@ jobs:
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: Show release informations
id: diff
run: |
LATEST_TAG=$(git describe --tags --abbrev=0)
PREVIOUS_TAG=$(git describe --tags --abbrev=0 $LATEST_TAG^)
CHANGES=$(git log $PREVIOUS_TAG..$LATEST_TAG --pretty=format:"- %s (%an)" --no-merges)
echo "LATEST_TAG=$LATEST_TAG"
echo "PREVIOUS_TAG=$PREVIOUS_TAG"
echo "CHANGES=$CHANGES"
echo "::set-output name=changelog::$CHANGES"
- name: Create a github release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
draft: false
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
このリリースでの変更点:
${{ steps.diff.outputs.changelog }}
draft: true

bash-artifact-upload:
# uses shadowJar task to provide the artifact
needs: release

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -39,23 +93,19 @@ jobs:
- name: Set up Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Grant execution permission for wrapper file
run: chmod +x ./gradlew ./gradlew.bat
run: chmod +x ./gradlew
- name: Gradle build action
uses: gradle/gradle-build-action@v2
with:
arguments: |
jpackageImage
-i
--scan
- name: compress artifact
run: zip -r release.zip build/jpackage/MinecraftTimeMachine
- name: Upload Release Asset
id: upload-release-asset
shadowJar
--stacktrace
- name: upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./release.zip
asset_name: release.zip
asset_content_type: application/zip
upload_url: ${{ needs.release.outputs.create_release.outputs.upload_url }}
asset_path: build/libs/mctimemachine-all.jar
asset_name: MinecraftTimeMachine-${{ github.ref }}-executable.jar
asset-content-type: application/java-archive
Loading

0 comments on commit 17486de

Please sign in to comment.