diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index da07fcb..da204f3 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -6,30 +6,25 @@ jobs: name: Build and Release runs-on: ubuntu-latest steps: - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - uses: actions/checkout@v5 - name: Set up JDK 21 uses: actions/setup-java@v5 with: java-version: '21' distribution: 'zulu' - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.6 - - name: Compile - run: mvn -B package --file pom.xml + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Make Gradle wrapper executable + run: chmod +x ./gradlew + - name: Build + run: ./gradlew build --no-daemon env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Get Version Number from Pom + - name: Get Version Number from Gradle id: get_version - run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + run: | + VERSION=$(./gradlew properties -q | awk -F': ' '/^version:/ {print $2; exit}') + echo "VERSION=$VERSION" >> "$GITHUB_ENV" - name: Extract latest CHANGELOG entry id: changelog run: | @@ -37,7 +32,7 @@ jobs: CHANGELOG_ESCAPED=$(echo "$CHANGELOG_CONTENT" | sed ':a;N;$!ba;s/\n/%0A/g') echo "Extracted latest release notes from CHANGELOG.md:" echo -e "$CHANGELOG_CONTENT" - echo "::set-output name=content::$CHANGELOG_ESCAPED" + echo "content=$CHANGELOG_ESCAPED" >> "$GITHUB_OUTPUT" - name: Create Release uses: actions/create-release@v1 id: create_release @@ -54,6 +49,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Universal/target/AntiVPN-${{ env.VERSION }}-universal.jar + asset_path: ./Universal/build/libs/AntiVPN-${{ env.VERSION }}-universal.jar asset_name: AntiVPN-v${{ env.VERSION }}.jar asset_content_type: application/java-archive diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..c7d5bbf --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,37 @@ +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'zulu' + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Make Gradle wrapper executable + run: chmod +x ./gradlew + - name: Build + run: ./gradlew build --no-daemon + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload AntiVPN + uses: actions/upload-artifact@v4 + with: + name: AntiVPN-Universal + path: Universal/build/libs/AntiVPN-*-universal.jar + - name: Upload Sponge plugin + uses: actions/upload-artifact@v4 + with: + name: AntiVPN-Sponge + path: Sponge/SpongeLoader/build/libs/*.jar diff --git a/.github/workflows/test-gradle.yml b/.github/workflows/test-gradle.yml new file mode 100644 index 0000000..82da86f --- /dev/null +++ b/.github/workflows/test-gradle.yml @@ -0,0 +1,22 @@ +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'zulu' + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Make Gradle wrapper executable + run: chmod +x ./gradlew + - name: Build + run: ./gradlew build --no-daemon + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}