Skip to content

Commit

Permalink
chore(repo): add basic publish config
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Gonzalez <[email protected]>
  • Loading branch information
SheepReaper committed Sep 11, 2023
1 parent 52045e8 commit 468d257
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 1 deletion.
83 changes: 83 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# name: Build and Release
# on:
# push:
# tags:
# - "*"

# jobs:
# build:
# runs-on: ubuntu-latest

# strategy:
# matrix:
# target:
# - linux-x64
# - linux-musl-x64
# - linux-arm
# - linux-arm64
# - osx-x64
# - osx-arm64
# - win-arm64
# - win-x64
# - win-x86

# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Setup .NET
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: "8.0"

# - name: Build and Publish
# run: dotnet publish ./src/yk-csr-cli/GenerateYKCSR.csproj -c Release -r ${{ matrix.target }} --self-contained /p:PublishReadyToRun=true -o out/${{ matrix.target }}

# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.target }}
# path: out/${{ matrix.target }}

# release:
# permissions:
# contents: write
# packages: write
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref }}
# release_name: Release ${{ github.ref }}
# draft: false
# prerelease: true

# - name: Download all artifacts
# uses: actions/download-artifact@v3
# with:
# path: ./artifacts

# - name: Prepare output directory
# run: mkdir -p out

# - run: |
# for target in linux-x64 linux-musl-x64 linux-arm linux-arm64 osx-x64 osx-arm64 win-arm64 win-x64 win-x86; do
# echo "Zipping $target..."
# zip -r ./out/$target.zip ./artifacts/$target
# done

# - run: |
# for target in linux-x64 linux-musl-x64 linux-arm linux-arm64 osx-x64 osx-arm64 win-arm64 win-x64 win-x86; do
# echo "Uploading $target..."
# gh release upload ${{ github.ref }} ./out/$target.zip --clobber
# done
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
release:
types: [published]

jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest

strategy:
matrix:
target:
- linux-x64
- linux-musl-x64
- linux-arm
- linux-arm64
- osx-x64
- osx-arm64
- win-arm64
- win-x64
- win-x86

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0"

- name: Build
run: dotnet publish ./src/yk-csr-cli/GenerateYKCSR.csproj -c Release -r ${{ matrix.target }} --self-contained /p:PublishReadyToRun=true -o out/${{ matrix.target }}

- name: Archive
run: zip -r ./out/${{ matrix.target }}.zip ./out/${{ matrix.target }}

- name: Upload
run: gh release upload ${{github.event.release.tag_name}} ./out/${{ matrix.target }}.zip
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
shell: bash
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,7 @@ obj/
# End of https://www.toptal.com/developers/gitignore/api/csharp,visualstudiocode,dotnetcore

# Test Files
*.csr
*.csr

# Other build dirs
out/
6 changes: 6 additions & 0 deletions src/yk-csr-cli/GenerateYKCSR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>rc1</VersionSuffix>
<UseAppHost>true</UseAppHost>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 468d257

Please sign in to comment.