Skip to content

Improve client injection speed & cleanup settings page. #744

Improve client injection speed & cleanup settings page.

Improve client injection speed & cleanup settings page. #744

Workflow file for this run

name: Build launcher and bump version number
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
bump-version-number:
outputs:
version_number: ${{ steps.get_new_version.outputs.version_no }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: check commit type
shell: bash
run: |
if [[ "${{ github.event.head_commit.message }}" == *"release:"* ]]; then
echo "Continuing to build as release"
else
echo "Not a release commit, exiting (note: this may take 5-10 seconds)"
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
fi
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: setup git
run: |
git config --global user.name "Github Actions"
git config --global user.email "actions@github.com"
- name: update file version
id: get_new_version
run: |
#parsed string
export old_version=$(cat "src/AssemblyVersion.cs" |sed -n 's/.*\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')
export new_version=$(cat "src/AssemblyVersion.cs" | tail -n 1 | sed -n 's/.*\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p' | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')
echo $old_version
echo $new_version
echo "version=$new_version" >> $GITHUB_ENV
echo "version_no=$new_version" >> "$GITHUB_OUTPUT"
sed -i "s/$old_version/$new_version/g" "src/AssemblyVersion.cs"
- name: push to origin
run: |
git add "src/AssemblyVersion.cs"
git commit -m "Update file version"
git push origin main
deploy:
needs: bump-version-number
runs-on: windows-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Output commit type
run: echo " ${{env.OUTPUT1}} $OUTPUT1"
env:
OUTPUT1: ${{ needs.bump-version-number.outputs.version_number}}
- name: Checkout cdn repository
uses: actions/checkout@v4
with:
repository: 'flarialmc/newcdn'
ref: 'main'
path: 'cdn'
token: ${{secrets.ACTIONS_GITHUB_TOKEN}}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build
run: |
dotnet publish "src/Flarial.Launcher/Flarial.Launcher.csproj"
# dotnet publish "extras/Flarial.Version.Changer/src/Flarial.Version.Changer.csproj"
# msbuild -t:Restore Flarial.Launcher.csproj
# msbuild /p:Configuration=Release /m Flarial.Launcher.csproj
- name: update new version
if: success()
run: |
cd cdn
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@example.com"
export new_version="${{ env.OUTPUT1 }}"
contents="$(jq '.version = "'$new_version'"' launcher/launcherVersion.txt)" && \
echo -E "${contents}" > launcher/launcherVersion.txt
cat launcher/launcherVersion.txt
git add launcher/launcherVersion.txt
git commit -m "Bump launcher version"
git push origin main
cp D:/a/launcher/launcher/src/Flarial.Launcher/bin/Release/publish/Flarial.Launcher.exe ./launcher/Flarial.Launcher.exe
git add launcher/Flarial.Launcher.exe
git commit -a -m "Update launcher"
git push origin main
# cp D:/a/launcher/launcher/extras/Flarial.Version.Changer/src/bin/Release/publish/Flarial.Version.Changer.exe ./launcher/Flarial.Version.Changer.exe
# git add launcher/Flarial.Version.Changer.exe
# git commit -a -m "Update version changer"
# git push origin main
env:
OUTPUT1: ${{ needs.bump-version-number.outputs.version_number}}
shell: bash