-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2fff658
Showing
8 changed files
with
839 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Publish releases | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
publish: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- name: Set env | ||
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:11}) | ||
- name: Set workspace env | ||
run: echo ::set-env name=GITHUB_WORKSPACE::$(echo ${GITHUB_WORKSPACE}) | ||
- name: Change NuGet package version | ||
run: sed -i -E 's/(<Version>)[^>]+(<\/Version>)/\1${{ env.RELEASE_VERSION }}\2/g' ${GITHUB_WORKSPACE}/badger.csproj && cat ${GITHUB_WORKSPACE}/badger.csproj | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '3.1.401' | ||
# Runs a single command using the runners shell | ||
- name: Publish osx-x64 | ||
run: dotnet publish -c release -r osx-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true | ||
- name: zip osx-x64 | ||
run: zip --junk-paths badger-osx-x64.zip ${GITHUB_WORKSPACE}/bin/release/netcoreapp3.1/osx-x64/publish/badger | ||
- name: Publish win-x64 | ||
run: dotnet publish -c release -r win-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true | ||
- name: zip win-x64 | ||
run: zip --junk-paths badger-win-x64.zip ${GITHUB_WORKSPACE}/bin/release/netcoreapp3.1/win-x64/publish/badger.exe | ||
- name: Publish linux-x64 | ||
run: dotnet publish -c release -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true | ||
- name: zip linux-x64 | ||
run: zip --junk-paths badger-linux-x64.zip ${GITHUB_WORKSPACE}/bin/release/netcoreapp3.1/linux-x64/publish/badger | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload osx-x64 assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./badger-osx-x64.zip | ||
asset_name: badger-osx-x64.zip | ||
asset_content_type: application/zip | ||
- name: Upload win-x64 assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./badger-win-x64.zip | ||
asset_name: badger-win-x64.zip | ||
asset_content_type: application/zip | ||
- name: Upload linux-x64 assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./badger-linux-x64.zip | ||
asset_name: badger-linux-x64.zip | ||
asset_content_type: application/zip | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build -c release --no-restore | ||
- name: Publish badger | ||
uses: rohith/publish-nuget@v2 | ||
with: | ||
PROJECT_FILE_PATH: ${{env.GITHUB_WORKSPACE}}/badger.csproj | ||
NUGET_KEY: ${{ secrets.NUGET_API_KEY }} | ||
- name: Publish to GitHub | ||
uses: tanaka-takayoshi/[email protected] | ||
with: | ||
nupkg-path: ${{env.GITHUB_WORKSPACE}}/bin/release/*.nupkg | ||
repo-owner: 'hex' | ||
gh-user: 'hex' | ||
token: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.