diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 710f0491e..93421b503 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -38,12 +38,6 @@ jobs: with: ref: dev - - name: Write release version - run: | - VERSION=${{ github.event.inputs.tag_name }} - echo "Releasing version: $VERSION" - sed -i -e 's@version = .\d*.\d*.\d*.*@version = "'"$VERSION"'"@g' build.gradle.kts - - name: Create or use provided tag run: | # Use provided tag from the input @@ -54,23 +48,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set up cache for Gradle - uses: actions/cache@v4 - with: - path: ~/.gradle/caches - key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - gradle-${{ runner.os }} - - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'corretto' - - - name: Build Gradle Project - run: ./gradlew build - github-release: name: Create GitHub Release runs-on: ubuntu-latest @@ -84,13 +61,37 @@ jobs: - name: Build Changelog id: changelog - uses: requarks/changelog-action@v11 + continue-on-error: true + uses: requarks/changelog-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: token: ${{ github.token }} tag: ${{ github.event.inputs.tag_name }} + - name: Write release version + run: | + VERSION=${{ github.event.inputs.tag_name }} + echo "Releasing version: $VERSION" + sed -i -e 's@version = .\d*.\d*.\d*.*@version = "'"$VERSION"'"@g' build.gradle.kts + + - name: Set up cache for Gradle + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }} + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'corretto' + + - name: Build Gradle Project + run: ./gradlew build + - name: Create release id: create_release uses: actions/create-release@v1 @@ -99,7 +100,7 @@ jobs: with: tag_name: ${{ github.event.inputs.tag_name }} release_name: Release ${{ github.event.inputs.tag_name }} - body: ${{ steps.changelog.outputs.changes }} + body: ${{ steps.changelog.outputs.changes || 'No changelog available' }} draft: false prerelease: false @@ -110,9 +111,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/libs/Fruzhin-${{ github.event.inputs.tag_name }}.jar - asset_name: Fruzhin-${{ github.event.inputs.tag_name }}.jar - asset_content_type: application/java-archive + asset_path: ./build/libs/Fruzhin-${{ github.event.inputs.tag_name }}.war + asset_name: Fruzhin-${{ github.event.inputs.tag_name }}.war + asset_content_type: application/x-zip npm-release: name: Publish to NPM @@ -125,18 +126,40 @@ jobs: with: ref: ${{ github.event.inputs.tag_name }} + - name: Set up cache for Gradle + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }} + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'corretto' + + - name: Build Gradle Project + run: ./gradlew build + - name: Unzip WAR file run: | - unzip build/libs/*.war -d dist - rm -rf dist/META-INF dist/WEB-INF dist/index.html + ls -l + unzip ./build/libs/*.war -d dist + rm -rf ./dist/META-INF ./dist/WEB-INF ./dist/index.html + + - name: Update package.json version + run: | + VERSION=${{ github.event.inputs.tag_name }} + echo "Updating package.json with version: $VERSION" + sed -i -e 's/"version": ".*"/"version": "'"$VERSION"'"/' package.json - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' - - - name: Install NPM dependencies - run: npm install + registry-url: "https://registry.npmjs.org" - name: Publish to NPM env: diff --git a/package.json b/package.json index b3acf4583..4581acfd1 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "fruzhin-web", + "name": "fruzhin", "version": "1.0.0", "description": "An implementation of Fruzhin's light client usable in the web.", "main": "./dist/js/fruzhin-lib.js",