Skip to content

Add github actions #33

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
f2590b0
adding windows build to test
sabuto Mar 14, 2022
cafd6eb
Merge pull request #1 from sabuto/feature/add-ghaction-for-build
sabuto Mar 14, 2022
dbae5c9
Update build-windows.yml
sabuto Mar 14, 2022
26438cb
add tag to release
sabuto Mar 14, 2022
551627b
rename and add linux
sabuto Mar 14, 2022
137891a
update things
sabuto Mar 14, 2022
1116cd8
update again
sabuto Mar 14, 2022
b366efd
try again
sabuto Mar 14, 2022
6b9c8b0
s
sabuto Mar 14, 2022
22bce54
rename build
sabuto Mar 14, 2022
468a4c2
test
sabuto Mar 14, 2022
e85a49f
updated events
sabuto Mar 14, 2022
54e48ad
update both workflows
sabuto Mar 14, 2022
bb87759
remove if statement
sabuto Mar 14, 2022
b8bbfdd
testing
sabuto Mar 14, 2022
86e2583
revert
sabuto Mar 14, 2022
4855671
uppdate required
sabuto Mar 14, 2022
c6a1b54
update things
sabuto Mar 14, 2022
29f0e27
update for tags
sabuto Mar 14, 2022
8e891d8
remove unnessasery job and update for windows build
sabuto Mar 14, 2022
c8fbc4b
add base installer with replaceable strings and update build release
sabuto Mar 14, 2022
daf8fc3
update path
sabuto Mar 14, 2022
713da8d
update for testing
sabuto Mar 15, 2022
0cc72c4
t
sabuto Mar 15, 2022
ac83ac4
t
sabuto Mar 15, 2022
cebed72
t
sabuto Mar 15, 2022
bd4e859
final build before pr
sabuto Mar 15, 2022
09d31d8
add mac build and add .app properties to csproj
sabuto Mar 15, 2022
15d39e6
add mac to overall build
sabuto Mar 15, 2022
c434243
trying mac build
sabuto Mar 15, 2022
cdbbd87
update some things
sabuto Mar 15, 2022
8ce5a23
debugging
sabuto Mar 15, 2022
6b62833
test
sabuto Mar 15, 2022
9d41930
t
sabuto Mar 15, 2022
36684e7
t
sabuto Mar 15, 2022
667476f
try with sips
sabuto Mar 15, 2022
f71bb32
debugging
sabuto Mar 15, 2022
5e7bbaf
path should work this time
sabuto Mar 15, 2022
a4d467e
try again
sabuto Mar 15, 2022
add46db
testing for pr
sabuto Mar 15, 2022
0f531f3
t
sabuto Mar 15, 2022
ee72de0
update name of linux build and tar
sabuto Mar 16, 2022
98b3c01
cleanup to make it better
sabuto Mar 16, 2022
547a19c
t
sabuto Mar 16, 2022
479ae03
testing with creating release from artifacts and pre-release
sabuto Mar 16, 2022
c27811e
try again
sabuto Mar 16, 2022
c5c75b6
try again
sabuto Mar 16, 2022
823ec7d
testing with things
sabuto Mar 16, 2022
1fded7b
remove pre-release
sabuto Mar 16, 2022
ac9a8d5
debug
sabuto Mar 16, 2022
4b8f4b8
hopefully fix paths
sabuto Mar 16, 2022
7722de7
debugging
sabuto Mar 16, 2022
ba75fb6
debug
sabuto Mar 16, 2022
fc78a64
debug
sabuto Mar 16, 2022
f7f145e
s
sabuto Mar 16, 2022
311f563
s
sabuto Mar 16, 2022
7e82773
re-add names
sabuto Mar 16, 2022
c50430c
paths?
sabuto Mar 16, 2022
e4bc696
should fix paths
sabuto Mar 16, 2022
25bda38
trying to get it to work on mac
sabuto Mar 17, 2022
232cedd
try using app host
sabuto Mar 17, 2022
1f9c90c
testing something
sabuto Mar 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/build-release-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: 'build All'

on:
push:
tags:
- 'v*'


jobs:
build-windows:
name: Build and release Windows Version
uses: ./.github/workflows/build-release-windows.yml
with:
version: ${{ github.ref }}
build-linux:
name: Build and release Linux Version
uses: ./.github/workflows/build-release-linux.yml
with:
version: ${{ github.ref }}
build-mac:
name: Build and release Mac Version
uses: ./.github/workflows/build-release-mac.yml
with:
version: ${{ github.ref }}
update-linux-installer:
name: Update linux installer file
needs:
- build-windows
- build-linux
- build-mac
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Version
id: get_version
uses: battila7/get-version-action@v2.2.1
- run: sed -i "s/__VERSION__/${{ steps.get_version.outputs.version}}/g" ./CutCode_linux_x64_installer.sh
- name: Upload installer file
uses: actions/upload-artifact@v3
with:
path: ./CutCode_linux_x64_installer.sh
create-release:
name: Create Release
needs:
- update-linux-installer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Version
id: get_version
uses: battila7/get-version-action@v2.2.1
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./Artifacts
- run: ls -R ./Artifacts
- name: linux installer
uses: svenstaro/upload-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/CutCode/CutCode/Artifacts/artifact/CutCode_linux_x64_installer.sh
asset_name: CutCode_linux_x64_installer.sh
tag: ${{ github.ref }}
prerelease: true
- name: linux build
uses: svenstaro/upload-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/CutCode/CutCode/Artifacts/LinuxBuild.tar.gz/CutCodeLinux.tar.gz
asset_name: LinuxBuild.tar.gz
tag: ${{ github.ref }}
prerelease: true
- name: Mac build
uses: svenstaro/upload-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/CutCode/CutCode/Artifacts/MacBuild.zip/CutCodeMac.zip
asset_name: MacBuild.zip
tag: ${{ github.ref }}
prerelease: true
- name: Windows build
uses: svenstaro/upload-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/CutCode/CutCode/Artifacts/WindowsBuild.zip/CutCodeWindows.zip
asset_name: WindowsBuild.zip
tag: ${{ github.ref }}
prerelease: true
34 changes: 34 additions & 0 deletions .github/workflows/build-release-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'build linux'

on:
workflow_call:
inputs:
version:
description: 'The version for the manual flow'
required: true
type: string

jobs:
build_linux:
name: Build Linux App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: setup .Net 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build Linux App
run: |
cd CutCode.CrossPlatform
dotnet publish -c Release -f net6.0 -r linux-x64
- name: Archive Artifact
run: |
cd CutCode.CrossPlatform/bin/Release/net6.0/linux-x64
tar -czvf CutCodeLinux.tar.gz publish
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: LinuxBuild.tar.gz
path: ./CutCode.CrossPlatform/bin/Release/net6.0/linux-x64/CutCodeLinux.tar.gz
46 changes: 46 additions & 0 deletions .github/workflows/build-release-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'build mac'

on:
workflow_call:
inputs:
version:
description: 'The version for the manual flow'
required: true
type: string


jobs:
build_mac:
name: Build Mac App
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: setup .Net 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build Mac App
run: |
cd CutCode.CrossPlatform
dotnet restore -r osx-x64
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release -p:UseAppHost=true
mkdir Assets/logo.iconset
sips -z 512 512 Assets/Images/logo.png --out Assets/logo.iconset/icon_512x512.png
ls Assets/logo.iconset
iconutil --convert icns Assets/logo.iconset
ls Assets
ls bin/Release/net6.0/osx-x64/publish
ls bin/Release/net6.0/osx-x64/publish/CutCode.app
ls bin/Release/net6.0/osx-x64/publish/CutCode.app/Contents/Resources
cp Assets/logo.icns bin/Release/net6.0/osx-x64/publish/CutCode.app/Contents/Resources/logo.icns
rm Assets/logo.icns
rm -rf Assets/logo.iconset
- name: Archive Artifact
run: |
cd CutCode.CrossPlatform/bin/Release/net6.0/osx-x64/publish
zip -r CutCodeMac.zip CutCode.app
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: MacBuild.zip
path: ./CutCode.CrossPlatform/bin/Release/net6.0/osx-x64/publish/CutCodeMac.zip
34 changes: 34 additions & 0 deletions .github/workflows/build-release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'build windows'

on:
workflow_call:
inputs:
version:
description: 'The version for the manual flow'
required: false
type: string

jobs:
build_windows:
name: Build Windows App
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: setup .Net 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build Windows App
run: |
cd CutCode.CrossPlatform
dotnet publish -c Release -f net6.0 -r win7-x64
- name: Archive Artifact
run: |
cd CutCode.CrossPlatform/bin/Release/net6.0/win7-x64
powershell Compress-Archive -Path .\publish -DestinationPath CutCodeWindows.zip
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: WindowsBuild.zip
path: ./CutCode.CrossPlatform/bin/Release/net6.0/win7-x64/CutCodeWindows.zip
14 changes: 14 additions & 0 deletions CutCode.CrossPlatform/CutCode.CrossPlatform.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
<StartupObject>CutCode.CrossPlatform.Program</StartupObject>
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<CFBundleName>CutCode</CFBundleName> <!-- Also defines .app file name -->
<CFBundleDisplayName>CutCode</CFBundleDisplayName>
<CFBundleIdentifier>com.cutcode</CFBundleIdentifier>
<CFBundleVersion>3.0.0</CFBundleVersion>
<CFBundleShortVersionString>3.0.0</CFBundleShortVersionString>
<CFBundlePackageType>AAPL</CFBundlePackageType>
<CFBundleSignature>????</CFBundleSignature>
<CFBundleExecutable>CutCode.CrossPlatform</CFBundleExecutable>
<CFBundleIconFile>/Assets/logo.icns</CFBundleIconFile> <!-- Will be copied from output directory -->
<NSPrincipalClass>NSApplication</NSPrincipalClass>
<NSHighResolutionCapable>true</NSHighResolutionCapable>
</PropertyGroup>
<ItemGroup>
<Folder Include="DataBase" />
<Folder Include="Models\" />
Expand All @@ -32,6 +45,7 @@
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.999-cibuild0017745-beta" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.999-cibuild0017745-beta" />
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
</ItemGroup>
Expand Down
46 changes: 46 additions & 0 deletions CutCode_linux_x64_installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
BASE_URL="https://github.com/Abdesol/CutCode/releases/download/"
VERSION="__VERSION__"
FILE="CutCodeLinux.tar.gz"
FOLDER="CutCode __VERSION__ linux x64"


if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi

#Make cutcode tmp file
rm -rf cutcode-tmp
mkdir cutcode-tmp
cd cutcode-tmp
dialog --infobox "installing CutCode..." 20 60
#Get built files and unzip them
curl -LO $BASE_URL/$VERSION/$FILE
tar -xf $FILE

#make directory to put built files into and put the files
rm -rf /opt/CutCode/
mkdir /opt/CutCode/
cp -r "$FOLDER"/* /opt/CutCode

#make needed file executables
chmod +x /opt/CutCode/CutCode
#add file to /usr/bin/ and make it executable
echo "/opt/CutCode/CutCode" > /usr/bin/CutCode
chmod +x /usr/bin/CutCode
#add .desktop file
cp "$FOLDER"/CutCode.desktop /usr/share/applications/

# Delete the temp file
cd ..
rm -rf cutcode-tmp

whiptail --msgbox "CutCode has been installed successfully"



if whiptail --yesno "Do you want to open CutCode?" 20 60 ;then
CutCode
else
whiptail --msgbox "Thanks for installing CutCode, you can either launch it by running CutCode or search for CutCode in your app drawer" 20 60
fi