Skip to content

Commit

Permalink
CI: create NuPkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjvs committed Sep 27, 2022
1 parent 8ece605 commit 9951d1b
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 130 deletions.
103 changes: 0 additions & 103 deletions .github/workflows/cd.yml

This file was deleted.

135 changes: 135 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Release

on:
push:
tags:
- 'v*'

defaults:
run:
shell: bash

jobs:
metadata:
name: Collect Metadata
uses: StirlingLabs/.github/.github/workflows/metadata.yaml@main
with:
coreName: sa

build:
name: Collect Metadata
uses: ./.github/workflows/integrate.yaml

github:
name: GitHub Release
runs-on: ubuntu-latest
needs: [ metadata, build ]
steps:
- name: Get Linux Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-Linux
path: artifacts/Linux
- name: Get macOS Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-macOS
path: artifacts/macOS
- name: Get Windows Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-Windows
path: artifacts/Windows
- name: Download Public Header
run: |
curl -H "Authorization: token ${{ github.token }}" \
-H 'Accept: application/vnd.github.v3.raw' \
-o artifacts/sa.h \
-L ${{ github.api_url }}/repos/${{ github.repository }}/contents/sa.h?ref=${{ github.ref_name }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v0.1.14
with:
name: libsa-${{ needs.metadata.outputs.fullVersion }}
files: |
artifacts/**
nuget:
name: NuPkg Release
needs: [ metadata, build ]
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- platform: Linux
runtime: linux-x64
result: libsa.so
- platform: macOS
runtime: osx
result: libsa.dylib
- platform: Windows
runtime: win-x64
result: sa.dll
fail-fast: true
steps:
- name: Get Artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.metadata.outputs.project }}-${{ matrix.platform }}
path: ${{ matrix.runtime }}

- name: Create NuSpec
run: |
ls -la
ls -la $platform
text="<?xml version=\"1.0\" encoding=\"utf-8\"?>"
text="$text\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">"
text="$text\n <metadata>"
text="$text\n <id>StirlingLabs.sockaddr.Net.runtime.$runtime.$project</id>"
text="$text\n <version>$version</version>"
text="$text\n <title>$project $version</title>"
text="$text\n <description>"
text="$text\n $project provides cross-platform socket address bindings."
text="$text\n This package provides the $project library on $runtime for consumption by sockaddr.Net."
text="$text\n </description>"
text="$text\n <authors>The Stirling Labs Team</authors>"
text="$text\n <projectUrl>$homepage</projectUrl>"
text="$text\n <readme>docs/Readme.md</readme>"
text="$text\n <icon>images/icon.png</icon>"
text="$text\n <tags>$project library SL sockets XP sockaddr StirlingLabs IP TCP UDP</tags>"
text="$text\n <license type=\"expression\">BSD-3-Clause</license>"
text="$text\n <requireLicenseAcceptance>true</requireLicenseAcceptance>"
text="$text\n <repository type=\"git\" url=\"$gitUrl\" branch=\"$branch\" commit=\"$commit\" />"
text="$text\n </metadata>"
text="$text\n <files>"
text="$text\n <file src=\"README.md\" target=\"docs/\" />"
text="$text\n <file src=\"docs/SL.png\" target=\"images/\" />"
text="$text\n <file src=\"$platform/$result\" target=\"runtimes/$runtime/native/\" />"
text="$text\n </files>"
text="$text\n</package>"
echo -e $text > $project.nuspec
cat $project.nuspec
env:
platform: ${{ matrix.platform }}
runtime: ${{ matrix.runtime }}
result: ${{ matrix.result }}
project: ${{ needs.metadata.outputs.project }}
version: ${{ needs.metadata.outputs.fullVersion }}
homepage: ${{ needs.metadata.outputs.homepage }}
license: ${{ github.repository.license.spdx_id }}
gitUrl: ${{ github.repository.git_url }}
url: https://github.com/StirlingLabs/assimp
repo: ${{ github.repositoryUrl }}
branch: ${{ needs.metadata.outputs.currentBranch }}
commit: ${{ github.sha }}

- name: Create NuPkg
run: |
nuget pack $project.nuspec
ls -la
- name: Upload NuPkg
run: |
dotnet nuget push *.nupkg -k ${{github.token}} -s https://nuget.pkg.github.com/${{github.repository_owner}}/index.json --no-symbols --skip-duplicate || true
# dotnet nuget push *.nupkg -k ${{secrets.NUGET_STIRLINGLABS_API_KEY}} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
tags:
- 'v*'
branches:
- 'main'

workflow_call:
inputs:
Expand Down
26 changes: 1 addition & 25 deletions .github/workflows/ci.yml → .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration
name: Integrate

on:
push:
Expand All @@ -18,21 +18,12 @@ jobs:
skip_check:
name: Skip Run Check
uses: StirlingLabs/.github/.github/workflows/threshold.yaml@main
with:
eventName: ${{ github.event_name }}
commitMessage: ${{ github.event.head_commit.message }}
pullRequestDraft: ${{ github.event.pull_request.draft == 'true' }}
refType: ${{ github.ref_type }}
refName: ${{ github.ref_name }}

metadata:
name: Collect Metadata
uses: StirlingLabs/.github/.github/workflows/metadata.yaml@main
with:
gitRepo: ${{ github.repository }}
coreName: sa
refType: ${{ github.ref_type }}
refName: ${{ github.ref_name }}

build:
name: Build
Expand Down Expand Up @@ -88,18 +79,3 @@ jobs:
name: ${{ needs.metadata.outputs.project }}-${{ runner.os }}
path: ${{ env.workingDir }}/${{ matrix.result }}
if-no-files-found: error

store:
name: Store Artifacts
needs: [ skip_check, metadata, build ]
runs-on: ubuntu-latest
steps:
- name: Collect Artifacts
uses: actions/download-artifact@v3
with:
name: |
${{ needs.metadata.outputs.project }}-Linux
${{ needs.metadata.outputs.project }}-macOS
${{ needs.metadata.outputs.project }}-Windows
path: collection

0 comments on commit 9951d1b

Please sign in to comment.