Skip to content

Desktop Publish

Desktop Publish #1

Workflow file for this run

name: Desktop Publish
on:
workflow_dispatch:
jobs:
build-browser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet workload install wasm-tools
- name: Publish
run: dotnet publish -c Release -o ./publish WebTranslator/WebTranslator.Browser
- name: Clone GitHub Pages Repository
env:
GH_TOKEN: ${{ secrets.CFPATools_Token }}
run: |
cd ..
git clone https://x-access-token:${GH_TOKEN}@github.com/CFPATools/cfpatools.github.io --depth=1 gh-pages
- name: Copy Files to GitHub Pages Repository
run: |
# Switch to the gh-pages directory in the parent directory
cd ../gh-pages
# Remove all files except .nojekyll and README.md
find . -type f ! -path './.git*' ! -name '.nojekyll' ! -name 'README.md' -delete
find . -type d ! -path . ! -path './.git*' ! -path './.git/*' -exec rm -rf {} +
# Copy new files from the publish directory
cp -r ${GITHUB_WORKSPACE}/publish/wwwroot/* .
# Configure git to recognize the action as the author
git config user.name github-actions
git config user.email [email protected]
# Add changes to git
git add .
git commit -m "Deploy updates $(date +'%Y-%m-%d %H:%M:%S')"
git push origin master # Ensure you're using the correct branch name
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Publish
run: dotnet publish -c Release -o ./publish WebTranslator/WebTranslator.Desktop
- name: Rename and Clean Windows Files
run: |
Move-Item -Path publish/WebTranslator.Desktop.exe -Destination publish/WebTranslator.exe
Remove-Item -Path publish/WebTranslator.Desktop.pdb, publish/WebTranslator.pdb -Force
- name: Upload Windows Build
uses: actions/upload-artifact@v2
with:
name: WebTranslator-windows_amd64
path: publish
compression-level: 9
build-ubuntu:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev p7zip-full
- name: Publish
run: dotnet publish -c Release -o ./publish WebTranslator/WebTranslator.Desktop
- name: Rename and Clean Ubuntu Files
run: |
mv publish/WebTranslator.Desktop publish/WebTranslator
rm -f publish/WebTranslator.Desktop.dbg publish/WebTranslator.pdb
- name: Upload Ubuntu Build
uses: actions/upload-artifact@v2
with:
name: WebTranslator-linux_amd64
path: publish
compression-level: 9
release:
needs: [build-windows, build-ubuntu]
runs-on: ubuntu-latest
steps:
- name: Download Windows Build
uses: actions/download-artifact@v2
with:
name: WebTranslator-windows_amd64
path: release/windows
- name: Download Ubuntu Build
uses: actions/download-artifact@v2
with:
name: WebTranslator-linux_amd64
path: release/ubuntu