build: Update files for release workflow. #19
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_VERSION: '0.0.626' | |
DOTNET_NOLOGO: true | |
strategy: | |
matrix: | |
include: | |
- platform: linux-x64 | |
self-contained: true | |
extra-args: '' | |
- platform: win-x64 | |
self-contained: false | |
extra-args: '--noPortable --framework net8.0-x64-runtime' | |
- platform: win-x64 | |
self-contained: true | |
extra-args: '--noInst --packTitle win-x64-portable' | |
is-portable: 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 --version ${{ env.VPK_VERSION }} | |
- name: Build Project | |
run: dotnet publish ${{ env.PROJECT }}/${{ env.PROJECT }}.csproj -c Release -o publish/${{ matrix.platform }}${{ matrix.is-portable && '-portable' || '' }} -r ${{ matrix.platform }} ${{ matrix.self-contained && '--self-contained' || '--no-self-contained' }} | |
- name: Download Previous Releases | |
run: vpk download github --repoUrl ${{ github.server_url }}/${{ github.repository }} --channel ${{ matrix.platform }}${{ matrix.is-portable && '-portable' || '' }} -o releases | |
- name: Pack New Release | |
run: vpk ${{ startsWith(matrix.platform, 'win') && '[win] ' || '' }}pack -u ${{ env.PROJECT }} -v ${{ steps.get-version.outputs.version }} -r ${{ matrix.platform }} --channel ${{ matrix.platform }}${{ matrix.is-portable && '-portable' || '' }} ${{ matrix.extra-args }} -p publish/${{ matrix.platform }}${{ matrix.is-portable && '-portable' || '' }} -o releases | |
- name: Rename and Update Portable Package | |
if: matrix.is-portable | |
run: | | |
mv releases/${{ env.PROJECT }}-${{ matrix.platform }}-portable-Portable.zip releases/${{ env.PROJECT }}-${{ matrix.platform }}-portable.zip | |
JSON_FILE="./releases/assets.${{ matrix.platform }}-portable.json" | |
sed -i 's/ResoniteModUpdater-win-x64-portable-Portable.zip/ResoniteModUpdater-win-x64-portable.zip/g' "$JSON_FILE" | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
prerelease: false | |
generate_release_notes: false | |
name: v${{ steps.get-version.outputs.version }} | |
tag_name: v${{ steps.get-version.outputs.version }} | |
target_commitish: ${{ github.sha }} | |
files: | | |
releases/**/releases.*.json | |
releases/**/*.nupkg | |
releases/**/*.zip | |
releases/**/*.exe | |
releases/**/*.AppImage | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |