From ca494212feb708726f3c1dadd6c94dd086cdfc58 Mon Sep 17 00:00:00 2001 From: Georg Jung Date: Fri, 26 Apr 2024 18:24:27 +0200 Subject: [PATCH] Make ci and nuget pack two different actions --- .github/workflows/ci.yml | 12 --------- .github/workflows/pack.yml | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/pack.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c70c3f8..b51f71a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,18 +40,6 @@ jobs: - run: cargo build --release working-directory: src/HuggingfaceTokenizer/RustLib - # Remove the html head with the logo from README for nupkg - - id: clean-readme - uses: sean0x42/markdown-extract@v2 - with: - file: README.md - pattern: 'FastBertTokenizer' - - uses: "DamianReeves/write-file-action@master" - with: - path: README.md - write-mode: overwrite - contents: ${{ steps.clean-readme.outputs.markdown }} - - run: dotnet restore /p:ContinuousIntegrationBuild=true - run: dotnet build -c Release --no-restore /p:ContinuousIntegrationBuild=true diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml new file mode 100644 index 0000000..5ebf271 --- /dev/null +++ b/.github/workflows/pack.yml @@ -0,0 +1,55 @@ +name: Pack + +on: + workflow_call: + inputs: + build-ref: + required: true + type: string + workflow_dispatch: + push: + +env: + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + +jobs: + build: + runs-on: ubuntu-22.04 + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + lfs: true + - uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget- + - uses: dotnet/nbgv@v0.4 + id: nbgv + + # Remove the html head with the logo from README for nupkg + - id: clean-readme + uses: sean0x42/markdown-extract@v2 + with: + file: README.md + pattern: 'FastBertTokenizer' + - uses: "DamianReeves/write-file-action@master" + with: + path: README.md + write-mode: overwrite + contents: ${{ steps.clean-readme.outputs.markdown }} + + - run: dotnet restore /p:ContinuousIntegrationBuild=true + - run: dotnet build -c Release --no-restore /p:ContinuousIntegrationBuild=true + + - run: dotnet pack -c Release --no-restore --no-build /p:ContinuousIntegrationBuild=true + - uses: actions/upload-artifact@v4 + with: + name: FastBertTokenizer-nupkg-${{ steps.nbgv.outputs.Version }} + path: bin/Packages/Release/**/*