ci: Bump GH workflow actions #94
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 | |
on: [push, pull_request] | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }} | |
AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }} | |
SemVer: ${{ steps.gitversion.outputs.semVer }} | |
ShortSha: ${{ steps.gitversion.outputs.shortSha }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: x # Latest | |
- name: Use GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
build_and_test: | |
runs-on: ubuntu-latest | |
outputs: | |
artifact_name: ${{ steps.prepare_artifacts.outputs.artifact_name }} | |
needs: prepare | |
steps: | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0 | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: dotnet build -c Release | |
- name: Test | |
run: dotnet test --no-restore | |
- name: Publish | |
run: dotnet publish --no-restore -c Release -o release /p:"AssemblyVersion=${{ steps.gitversion.outputs.assemblySemFileVer }};FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }};InformationalVersion=${{ steps.gitversion.outputs.SemVer }}-${{ steps.gitversion.outputs.ShortSha }}" | |
- name: Prepare artifacts | |
id: prepare_artifacts | |
run: | | |
cp {README,xvd_info,CHANGELOG}.md release | |
echo "artifact_name=XVDTool-${{ needs.prepare.outputs.SemVer }}-${{ needs.prepare.outputs.ShortSha }}" >> $GITHUB_OUTPUT | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepare_artifacts.outputs.artifact_name }} | |
path: release | |
if-no-files-found: error | |
create_release: | |
runs-on: ubuntu-latest | |
needs: [prepare, build_and_test] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Generate zip | |
run: zip -j XVDTool-${{ needs.prepare.outputs.AssemblySemVer }}.zip ${{ needs.build_and_test.outputs.artifact_name }}/* | |
- name: Create release (on tag) | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Release ${{ github.ref }} | |
tag_name: ${{ github.ref }} | |
files: 'XVDTool-*.zip' | |
fail_on_unmatched_files: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |