Skip to content

Replace regexp with specified files for artifact #231

Replace regexp with specified files for artifact

Replace regexp with specified files for artifact #231

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET-build-publish
on:
push:
tags:
- 'v*'
jobs:
build:
permissions: write-all
runs-on: windows-latest
strategy:
matrix:
arch: [x86, x64]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Extract version from tag
id: version
run: |
$version = "${{ github.ref_name }}".TrimStart("v").TrimEnd("-test")
echo "version=$version" >> $env:GITHUB_ENV
- name: Set assembly version
run: |
.\SetVersionNumberConsole.ps1 -ver $env:version
- name: Build
run: dotnet build -c Release -p:Platform=${{ matrix.arch }} --output ./bin/
- name: Write build time
run: date +"%Y-%m-%d %H:%M" > ./bin/build && echo "latest" >> ./bin/build
- name: Copy prefabs
run: cp "./Resources/prefabs" "./bin" -r
- name: Cleaning output symbols
run: del ./bin/*.pdb
- name: Set app version
run: |
Set-Content -Path ./Build/Sledge.Editor.New.Installer.nsi -Value ((Get-Content './Build/Sledge.Editor.New.Installer.nsi' -Raw) -replace "{version}", "$env:version")
- name: Set app arch
run: |
Set-Content -Path ./Build/Sledge.Editor.New.Installer.nsi -Value ((Get-Content './Build/Sledge.Editor.New.Installer.nsi' -Raw) -replace "{arch}", "${{ matrix.arch }}")
- name: 'Install makensis (choco)'
run: choco install nsis
- name: Build installer
uses: joncloud/makensis-action@v5.0
with:
script-file: ./Build/Sledge.Editor.New.Installer.nsi
- name: Create Zip File
uses: vimtor/action-zip@v1.1
with:
files: ./bin/
dest: ./HammerTime.${{ matrix.arch }}.zip
- name: Save Artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.arch }}
path: |
./Hammertime.*.exe
./Hammertime.${{ matrix.arch }}.zip
release:
permissions: write-all
runs-on: windows-latest
needs: build
steps:
- name: Download x86 artifact
uses: actions/download-artifact@v5
with:
name: build-x86
path: ./dist/x86
- name: Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
./dist/x86/*
automatic_release_tag: test-release