Skip to content

Commit

Permalink
📦 Setup publish workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
heytherewill committed Oct 14, 2023
1 parent fba91f0 commit 3d38221
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/cron_pre_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Pre-Release
on:
schedule:
- cron: 0 0 * * *

jobs:
pack:
name: 📦 Pack and publish to NuGet
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100-rc.1.23463.5

- name: Setup NuGet
uses: NuGet/[email protected]

- name: Pack and push
run: |
tag=$(git describe --tags --abbrev=0)
version="$tag.$(git rev-list --count HEAD)-dev"
dotnet build -c Release
dotnet pack -c Release /p:Version=$version
dotnet nuget push ./src/**/bin/Release/Murder.*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${NUGET_TOKEN}
env:
NUGET_TOKEN: ${{secrets.NUGET_TOKEN}}
82 changes: 82 additions & 0 deletions .github/workflows/tag_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Publish Release
on:
release:
types: [published]

jobs:
release:
name: 📪 Release to GitHub
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
- kind: windows
os: windows-latest
target: win-x64
- kind: macOS
os: macos-latest
target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100-rc.1.23463.5

- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="murder-$tag-${{ matrix.target }}"
# Build everything
dotnet publish --runtime "${{ matrix.target }}" -c Release -o "$release_name" --no-self-contained
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "murder-release*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pack:
name: 📦 Pack and publish to NuGet
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100-rc.1.23463.5

- name: Setup NuGet
uses: NuGet/[email protected]

- name: Pack and push
run: |
version=$(git describe --tags --abbrev=0)
dotnet build -c Release
dotnet pack -c Release /p:Version=$version
dotnet nuget push ./src/**/bin/Release/Murder.*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${NUGET_TOKEN}
env:
NUGET_TOKEN: ${{secrets.NUGET_TOKEN}}

0 comments on commit 3d38221

Please sign in to comment.