fix getting external ip #867
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: Emulator CI/CD | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
# 0.0.0 | |
type: string | |
changelog: | |
type: string | |
push: | |
branches: | |
- main | |
- releases/* | |
# paths-ignore: | |
# - '**.md' | |
pull_request: | |
run-name: ${{ github.event_name == 'workflow_dispatch' && (inputs.version && format('Publish version:{0} sha:{1}', inputs.version, github.sha) || format('Emulator CI/CD sha:{0}', github.sha)) || '' }} | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runtime: | |
- linux-x64 | |
- linux-arm | |
- linux-arm64 | |
- linux-musl-x64 | |
- linux-musl-arm | |
- linux-musl-arm64 | |
- win-x86 | |
- win-x64 | |
- win-arm64 | |
- osx-x64 | |
- osx-arm64 | |
fxdependent: [ true, false ] | |
runs-on: ${{ contains(matrix.runtime, 'osx') && 'macos-latest' || 'ubuntu-latest' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- run: dotnet msbuild src/dir.proj -t:GenerateConstant -p:RunnerVersion=${{ inputs.version || '3.0.0' }} -p:PackageRuntime=${{ !matrix.fxdependent && matrix.runtime || 'Any' }} | |
- run: dotnet publish src/Runner.Client ${{ matrix.fxdependent && '--no-self-contained -p:RuntimeFrameworkVersion=8.0.0' || '--sc' }} -c Release -p:BUILD_OS=${{ matrix.fxdependent && 'Any' || startsWith(matrix.runtime, 'win-') && 'Windows' || startsWith(matrix.runtime, 'osx-') && 'OSX' || 'Linux' }} -r ${{ matrix.runtime }} -p:Version=${{ inputs.version || '3.0.0' }} -o output | |
- name: Package tar | |
if: ${{ !startsWith(matrix.runtime, 'win-') }} | |
run: | | |
tar czf ../runner.server-${{matrix.runtime}}${{ matrix.fxdependent && '-fxdependent' || '' }}.tar.gz ./* | |
working-directory: output | |
- name: Package zip | |
if: ${{ startsWith(matrix.runtime, 'win-') }} | |
run: | | |
zip -r ../runner.server-${{matrix.runtime}}${{ matrix.fxdependent && '-fxdependent' || '' }}.zip ./* | |
working-directory: output | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: runner.server-${{matrix.runtime}}${{ matrix.fxdependent && '-fxdependent' || '' }} | |
path: 'runner.server-${{matrix.runtime}}*' | |
publish-to-github: | |
if: inputs.version | |
runs-on: ubuntu-latest | |
needs: build | |
continue-on-error: true | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "*" | |
path: "artifacts" | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/**/*.zip,artifacts/**/*.tar.gz" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ inputs.version }} | |
commit: ${{ github.sha }} | |
body: | | |
# Changes | |
${{ fromjson(inputs.changelog) }} | |
publish: | |
if: inputs.version | |
needs: publish-to-github | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '6.0.x' | |
- name: GenerateConstant | |
run: dotnet msbuild ./dir.proj -t:GenerateConstant -p:RunnerVersion=${{ inputs.version }} -p:PackageRuntime=any | |
shell: pwsh | |
working-directory: ./src | |
- name: Pack | |
run: | | |
dotnet pack -c Release -p:BUILD_OS=Any -p:Version=${{ inputs.version }}.6 -p:RuntimeFrameworkVersion=6.0.0 -p:CHANGELOG_URL=https://github.com/ChristopherHX/runner.server/releases/tag/v${{ inputs.version }} | |
dotnet pack -c Release -p:BUILD_OS=Any -p:Version=${{ inputs.version }}.6 -p:RuntimeFrameworkVersion=6.0.0 -p:CHANGELOG_URL=https://github.com/ChristopherHX/runner.server/releases/tag/v${{ inputs.version }} /p:LegacyDotnetTool=1 | |
dotnet pack -c Release -p:BUILD_OS=Any -p:Version=${{ inputs.version }}.8 -p:RuntimeFrameworkVersion=8.0.0 -p:CHANGELOG_URL=https://github.com/ChristopherHX/runner.server/releases/tag/v${{ inputs.version }} | |
dotnet pack -c Release -p:BUILD_OS=Any -p:Version=${{ inputs.version }}.8 -p:RuntimeFrameworkVersion=8.0.0 -p:CHANGELOG_URL=https://github.com/ChristopherHX/runner.server/releases/tag/v${{ inputs.version }} /p:LegacyDotnetTool=1 | |
shell: pwsh | |
working-directory: ./src/Runner.Client | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nupkg | |
path: src/Runner.Client/nupkg | |
- name: Push to Nuget | |
if: env.GHARUN != '' | |
run: dotnet nuget push ./*.nupkg --api-key $($ENV:GHARUN) --source https://api.nuget.org/v3/index.json | |
shell: pwsh | |
working-directory: ./src/Runner.Client/nupkg | |
env: | |
GHARUN: ${{secrets.GHARUN}} | |
- name: Push to GitHub Packages | |
if: ${{ github.server_url == 'https://github.com' }} | |
run: | | |
dotnet nuget push ./*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols | |
working-directory: ./src/Runner.Client/nupkg | |
continue-on-error: true |