Update cd.yml #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cd | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate Cargo.lock | |
run: cargo generate-lockfile | |
working-directory: ./src-tauri | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: "./src-tauri -> target" | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Setup GitVersion | |
run: dotnet tool install --global GitVersion.Tool | |
- name: Fetch for GitVersion | |
run: git fetch --tags --unshallow | |
- name: Fetch main for GitVersion | |
if: github.ref != 'refs/heads/main' | |
run: git branch --create-reflog main origin/main | |
- name: Update version | |
run: dotnet-gitversion /updateprojectfiles /updateassemblyinfo /output buildserver | |
- name: Set job output | |
id: VERSION | |
run: | | |
echo '::set-output name=label::${{env.GitVersion_PreReleaseLabel}}' | |
echo '::set-output name=semver::${{env.GitVersion_LegacySemVer}}' | |
echo '::set-output name=nuget::${{env.GitVersion_NuGetPreReleaseTagV2}}' | |
echo '::set-output name=applicable::${{env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta' }}' | |
- name: Apply changes | |
if: ${{ steps.VERSION.outputs.applicable == 'true' && steps.extract_branch.outputs.branch == 'main' }} | |
uses: EndBug/add-and-commit@v6.2.0 | |
with: | |
author_name: github-actions[bot] | |
author_email: github-actions[bot]@users.noreply.github.com | |
message: "Bumped version to ${{env.GitVersion_LegacySemVer}}" | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v1 | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v1 | |
- name: Setup Yarn | |
run: npm install --global yarn && yarn | |
- name: Restore plugin packages | |
run: dotnet restore | |
working-directory: src-plugin | |
- name: Restore client packages | |
run: yarn install | |
working-directory: src-client | |
- name: Build | |
run: dotnet build -c Release | |
working-directory: src-plugin | |
- name: Make EliteVA-plugin | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: mkdir "EliteVA-plugin" | |
working-directory: src-plugin | |
- name: Copy to EliteVA-plugin | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: xcopy "EliteVA\bin\Release\net472\" "EliteVA-plugin" /Y /I | |
working-directory: src-plugin | |
- name: Add Costura.Fody | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: dotnet add package Costura.Fody | |
working-directory: src-plugin\EliteVA | |
- name: Build | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: dotnet build -c Release | |
working-directory: src-plugin | |
- name: Copy to EliteVA-plugin | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: xcopy "EliteVA\bin\Release\net472\" "EliteVA-plugin" /Y /I | |
working-directory: src-plugin | |
- name: Generate profile | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: dotnet run --project ProfileGenerator -c Release | |
working-directory: src-plugin | |
- name: Copy to EliteVA-plugin\EliteVA-${{ steps.VERSION.outputs.semver }}.vap | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
run: echo F|xcopy "Profile.vap" "EliteVA-${{ steps.VERSION.outputs.semver }}.vap" /Y /I | |
working-directory: src-plugin | |
- name: Zip dist | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
uses: thedoctor0/zip-release@0.7.1 | |
with: | |
type: "zip" | |
filename: "EliteVA.zip" | |
directory: "src-plugin/EliteVA-plugin" | |
- name: Build updater | |
run: yarn tauri build | |
- name: Move updater | |
run: copy "src-tauri\target\release\EliteVA.exe" "EliteVA-updater.exe" | |
- name: Release | |
if: github.ref == 'refs/heads/main' && ${{ steps.VERSION.outputs.applicable == 'true' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.VERSION.outputs.semver }} | |
files: | | |
EliteVA.zip | |
EliteVA-${{ steps.VERSION.outputs.semver }}.vap | |
EliteVA-updater.exe | |
prerelease: ${{ steps.extract_branch.outputs.branch != 'main' }} | |
draft: true |