build: Update GitHub Actions workflow to enable merging of VPK files. #7
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: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
- update-resonite-mod-updater-utils | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
PROJECT: ResoniteModUpdater | |
DOTNET_VERSION: '8.0.x' | |
VPK_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VPK_MERGE: true | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Get Version from Project File | |
id: get-version | |
shell: bash | |
run: echo "version=$(grep -oE '<AssemblyVersion>[^<]+' ${{ env.PROJECT }}/${{ env.PROJECT }}.csproj | sed 's/<AssemblyVersion>//')" >> $GITHUB_OUTPUT | |
- name: Install Velopack CLI | |
run: dotnet tool install -g vpk | |
- name: Build and Pack (Linux) | |
run: | | |
dotnet publish ${{ env.PROJECT }}/${{ env.PROJECT }}.csproj -c Release -o publish/linux-x64 -r linux-x64 --self-contained | |
vpk download github --repoUrl ${{ github.server_url }}/${{ github.repository }} --channel linux-x64 -o releases | |
vpk pack -u ${{ env.PROJECT }} -v ${{ steps.get-version.outputs.version }} -r linux-x64 --channel linux-x64 -p publish/linux-x64 -o releases | |
vpk upload github --repoUrl ${{ github.server_url }}/${{ github.repository }} --releaseName "v${{ steps.get-version.outputs.version }}" --tag v${{ steps.get-version.outputs.version }} --channel linux-x64 -o releases | |
- name: Build and Pack (Windows) | |
run: | | |
dotnet publish ${{ env.PROJECT }}/${{ env.PROJECT }}.csproj -c Release -o publish/win-x64 -r win-x64 --no-self-contained | |
vpk download github --repoUrl ${{ github.server_url }}/${{ github.repository }} --channel win-x64 -o releases | |
vpk [win] pack -u ${{ env.PROJECT }} -v ${{ steps.get-version.outputs.version }} -r win-x64 --channel win-x64 --noPortable --framework net8.0-x64-runtime -p publish/win-x64 -o releases | |
vpk upload github --repoUrl ${{ github.server_url }}/${{ github.repository }} --releaseName "v${{ steps.get-version.outputs.version }}" --tag v${{ steps.get-version.outputs.version }} --channel win-x64 -o releases | |
- name: Build and Pack (Windows portable) | |
run: | | |
dotnet publish ${{ env.PROJECT }}/${{ env.PROJECT }}.csproj -c Release -o publish/win-x64-portable -r win-x64 --self-contained | |
vpk download github --repoUrl ${{ github.server_url }}/${{ github.repository }} --channel win-x64-portable -o releases | |
vpk [win] pack -u ${{ env.PROJECT }} -v ${{ steps.get-version.outputs.version }} -r win-x64 --channel win-x64-portable --noInst --packTitle win-x64-portable -p publish/win-x64-portable -o releases | |
mv releases/${{ env.PROJECT }}-win-x64-portable-Portable.zip releases/${{ env.PROJECT }}-win-x64-portable.zip | |
vpk upload github --repoUrl ${{ github.server_url }}/${{ github.repository }} --releaseName "v${{ steps.get-version.outputs.version }}" --tag v${{ steps.get-version.outputs.version }} --channel win-x64-portable -o releases |