114 lines
No EOL
3.5 KiB
YAML
114 lines
No EOL
3.5 KiB
YAML
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 "(?<=<FileVersion>)[^<]+" 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
|
|
|
|
- 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
|
|
|
|
- name: Build the project (OSX x64)
|
|
run: |
|
|
dotnet publish ./Cryptura/Cryptura.csproj \
|
|
-c Release \
|
|
-r osx-x64 \
|
|
--self-contained true \
|
|
-p:PublishSingleFile=true \
|
|
-p:PublishTrimmed=true \
|
|
-o ./output_osx
|
|
|
|
- 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/* 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
|
|
zip -r ./release/Cryptura_Windows_x64.zip ./output_win
|
|
zip -r ./release/Cryptura_OSX_x64.zip ./output_osx
|
|
rm -rf ./output_linux ./output_win ./output_osx
|
|
|
|
|
|
- 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 }}" |