name: Java CI on: push: branches: - master jobs: test: runs-on: arch-rolling steps: - name: Check Dotnet Version run: | dotnet --version - name: Checkout code uses: actions/checkout@v4 - name: Extract FileVersion from .csproj id: get_version run: | version=$(grep -oPm1 "(?<=)[^<]+" Cryptura/Cryptura.csproj) echo "Cryptura version: $version" echo "version=$version" >> $GITHUB_OUTPUT - name: Check if release tag already exists run: | tag="v${{ steps.get_version.outputs.version }}" if git ls-remote --tags origin | grep -q "refs/tags/$tag"; then echo "Release tag $tag already exists. Cancelling workflow." exit 1 fi - name: Build the project (Linux x64) run: | dotnet publish ./Cryptura/Cryptura.csproj \ -c Release \ -r linux-x64 \ --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ -o ./output_linux_x64 - name: Build the project (Linux arm64) run: | dotnet publish ./Cryptura/Cryptura.csproj \ -c Release \ -r linux-arm64 \ --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ -o ./output_linux_arm64 - name: Build the project (Windows x64) run: | dotnet publish ./Cryptura/Cryptura.csproj \ -c Release \ -r win-x64 \ --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ -o ./output_win_x64 - name: Build the project (Windows arm64) run: | dotnet publish ./Cryptura/Cryptura.csproj \ -c Release \ -r win-arm64 \ --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ -o ./output_win_arm64 - name: Download appimagetool run: | curl -L -o appimagetool-x86_64.AppImage https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage chmod +x appimagetool-x86_64.AppImage - name: Build AppImage run: | mkdir -p Cryptura.AppDir/usr/bin cp -r ./output_linux_x64/* Cryptura.AppDir/usr/bin/ cp Cryptura/Assets/AppRun Cryptura.AppDir/ cp Cryptura/Assets/cryptura.desktop Cryptura.AppDir/ cp Cryptura/Assets/cryptura.png Cryptura.AppDir/ chmod +x Cryptura.AppDir/AppRun ./appimagetool-x86_64.AppImage Cryptura.AppDir mkdir -p release mv Cryptura-x86_64.AppImage release/Cryptura_Linux_x64.AppImage - name: Pack Releases into Zips run: | mkdir -p ./release zip -r ./release/Cryptura_Linux_x64.zip ./output_linux_x64 zip -r ./release/Cryptura_Linux_arm64.zip ./output_linux_arm64 zip -r ./release/Cryptura_Windows_x64.zip ./output_win_x64 zip -r ./release/Cryptura_Windows_arm64.zip ./output_win_arm64 rm -rf ./output_linux_x64 ./output_linux_arm64 ./output_win_x64 ./output_win_arm64 - name: Create Git tag run: | git config user.name "WeeXnes" git config user.email "somtrigi@gmail.com" git tag v${{ steps.get_version.outputs.version }} git push origin v${{ steps.get_version.outputs.version }} - name: Upload to Forgejo uses: actions/forgejo-release@v2.6.0 with: direction: upload url: https://git.weexnes.dev/ repo: WeeXnes/Cryptura token: ${{ secrets.RELEASE_TOKEN }} tag: v${{ steps.get_version.outputs.version }} release-dir: release release-notes: "Automated release for version ${{ steps.get_version.outputs.version }}"