From 59cb1e633fe4106495adec74c65a940ce78df973 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 23 Jan 2024 11:02:21 -0800 Subject: [PATCH] Upload archives with source code on release (#324) * upload tar.gz for new releases * revert name to manually trigger it * write to separate path * Update and rename nuget.yml to release.yml * disable nuget for testing * add a zip as well * error handling * Update release.yml * simple conditional trying https://unix.stackexchange.com/a/344207 * Update release.yml * back to basics * exclude .git folder * fix order for args * protect glob * fix order * remove remove testing code --- .github/workflows/nuget.yml | 27 --------------------- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/nuget.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml deleted file mode 100644 index 03d57762c..000000000 --- a/.github/workflows/nuget.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Nuget CD - -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup NuGet - uses: NuGet/setup-nuget@v1 - with: - nuget-api-key: ${{ secrets.nuget_api_key }} - - - name: Create NuGet pkg - working-directory: ./nuget - run: nuget pack jwt-cpp.nuspec - - - name: Publish NuGet pkg - working-directory: ./nuget - run: nuget push *.nupkg -Source 'https://api.nuget.org/v3/index.json' - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..7cd7ef531 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Nuget CD + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release + release: + types: [published] + +jobs: + nuget: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup NuGet + uses: NuGet/setup-nuget@v1 + with: + nuget-api-key: ${{ secrets.nuget_api_key }} + + - name: Create NuGet pkg + working-directory: ./nuget + run: nuget pack jwt-cpp.nuspec + + - name: Publish NuGet pkg + working-directory: ./nuget + run: nuget push *.nupkg -Source 'https://api.nuget.org/v3/index.json' + + release-asset: + if: github.event_name != 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: tar --exclude='./.git' -vczf /tmp/jwt-cpp-${{ github.event.release.tag_name }}.tar.gz . + - uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: /tmp/jwt-cpp-${{ github.event.release.tag_name }}.tar.gz + + - run: zip -x './.git/*' -r /tmp/jwt-cpp-${{ github.event.release.tag_name }}.zip . + - uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: /tmp/jwt-cpp-${{ github.event.release.tag_name }}.zip