Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.
/ SampSharp-build Public archive

SampSharp shared build script code. Can possibly also be used with projects other than SampSharp.

License

Notifications You must be signed in to change notification settings

ikkentim/SampSharp-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SampSharp-build

SampSharp shared build script code. Can possibly also be used with projects other than SampSharp.

Setup

  1. Stick the contents of the root directory into the root of your project
  2. Configure build.cake in your project root
  3. Add this repository as a submodule using git submodule add https://github.com/ikkentim/SampSharp-build.git cake
  4. Add tools/ to your .gitignore
  5. Add the following environment variables to the AppVeyor settings for your repository:
  • NUGET_KEY: The NuGet key to publish with
  • GITHUB_TOKEN: The GitHub token to use to publish a release
  1. Make sure your projects are at src/PROJECTNAME/PROJECTNAME.csproj
  2. Install the dotnet-cake tool: dotnet tool install Cake.Tool
  3. Add a GitHub Action to the project
  4. Make sure your project is configured to build (in release mode) to repo-root/bin
  5. Add the following to your csproj files:
    <!-- Add to the default ProjectGroup -->
    <Version>0.0.0-localbuild</Version>
    <AssemblyVersion>0.0.0</AssemblyVersion>
    <PackageReleaseNotes>placeholder</PackageReleaseNotes>
    <PublishRepositoryUrl>true</PublishRepositoryUrl>
    <EmbedUntrackedSources>true</EmbedUntrackedSources>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

  <!-- Add to Project -->
  <PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
     <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
  </ItemGroup>

GitHub Action

This template works as a good base, you possibly need to tweak it.

name: Cake
on:
  push:
    branches: [ master ]
    paths:
      - src/**
      - CHANGES.md

  pull_request:
    branches: [ master ]
    paths:
      - .github/workflows
      - src/**
      - CHANGES.md

  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v2

      - name: Checkout submodules
        run: git submodule update --init --recursive

      - name: Run the Cake script
        uses: cake-build/cake-action@v1
        with:
          script-path: build.cake
          target: CI

      - name: Upload artifacts
        uses: actions/upload-artifact@v2
        with:
          name: nuget-packages
          path: |
            bin/Release/*.nupkg
            bin/**/*.dll
            bin/**/*.pdb
            bin/**/*.xml

Building

  • Run dotnet cake to build.

Creating New Releases

  1. Update your CHANGES.md (see versioning).
  2. Create a git tag: git tag <TAG>. If you want to create a prerelease, use <VERSION>-alpha as tag. You can also number your prereleases like <VERSION>-alpha2.
  3. Push your tags, git push --tags and the GitHub Action will take care of the rest.

Example of usage: ikkentim/SampSharp

About

SampSharp shared build script code. Can possibly also be used with projects other than SampSharp.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages