diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml new file mode 100644 index 0000000..4123479 --- /dev/null +++ b/.github/workflows/build_and_release.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..642a05d --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.gitignore b/.gitignore index c27de8b..b9852a7 100644 --- a/.gitignore +++ b/.gitignore @@ -424,4 +424,7 @@ obj/ # End of https://www.toptal.com/developers/gitignore/api/csharp,visualstudiocode,dotnetcore # Test Files -*.csr \ No newline at end of file +*.csr + +# Other build dirs +out/ \ No newline at end of file diff --git a/src/yk-csr-cli/GenerateYKCSR.csproj b/src/yk-csr-cli/GenerateYKCSR.csproj index 049759f..0cbf113 100644 --- a/src/yk-csr-cli/GenerateYKCSR.csproj +++ b/src/yk-csr-cli/GenerateYKCSR.csproj @@ -6,6 +6,12 @@ enable enable preview + 1.0.0 + rc1 + true + true + true + false