|
| 1 | +# This was generated by tool. Edits will be overwritten. |
| 2 | + |
| 3 | +name: memory-cache/release |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N' |
| 9 | + type: string |
| 10 | + required: true |
| 11 | + default: '0.0.0' |
| 12 | + branch: |
| 13 | + description: '(Optional) the name of the branch to release from' |
| 14 | + type: string |
| 15 | + required: false |
| 16 | + default: 'main' |
| 17 | + remove-tag-if-exists: |
| 18 | + description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action' |
| 19 | + type: boolean |
| 20 | + required: false |
| 21 | + default: false |
| 22 | +env: |
| 23 | + DOTNET_NOLOGO: true |
| 24 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 25 | +jobs: |
| 26 | + tag: |
| 27 | + name: Tag and Pack |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + contents: write |
| 31 | + packages: write |
| 32 | + defaults: |
| 33 | + run: |
| 34 | + shell: bash |
| 35 | + working-directory: memory-cache |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + fetch-depth: 0 |
| 41 | + - name: Validate Version Input |
| 42 | + run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' || (echo 'Invalid version format' && exit 1) |
| 43 | + - name: Checkout target branch |
| 44 | + if: github.event.inputs.branch != 'main' |
| 45 | + run: git checkout ${{ github.event.inputs.branch }} |
| 46 | + - name: Setup Dotnet |
| 47 | + uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d |
| 48 | + with: |
| 49 | + dotnet-version: 10.0.100 |
| 50 | + - name: Git Config |
| 51 | + run: |- |
| 52 | + git config --global user.email "github-bot@duendesoftware.com" |
| 53 | + git config --global user.name "Duende Software GitHub Bot" |
| 54 | + - name: Remove previous git tag |
| 55 | + if: github.event.inputs['remove-tag-if-exists'] == 'true' |
| 56 | + run: |- |
| 57 | + if git rev-parse ecm-${{ github.event.inputs.version }} >/dev/null 2>&1; then |
| 58 | + git tag -d ecm-${{ github.event.inputs.version }} |
| 59 | + git push --delete origin ecm-${{ github.event.inputs.version }} |
| 60 | + else |
| 61 | + echo 'Tag ecm-${{ github.event.inputs.version }} does not exist.' |
| 62 | + fi |
| 63 | + - name: Git tag |
| 64 | + run: |- |
| 65 | + git tag -a ecm-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}" |
| 66 | + git push origin ecm-${{ github.event.inputs.version }} |
| 67 | + - name: Pack Extensions.Caching.Memory |
| 68 | + run: dotnet pack -c Release src/Extensions.Caching.Memory -o artifacts |
| 69 | + - name: Tool restore |
| 70 | + run: dotnet tool restore |
| 71 | + - name: Sign packages |
| 72 | + run: |- |
| 73 | + for file in artifacts/*.nupkg; do |
| 74 | + dotnet NuGetKeyVaultSignTool sign "$file" --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-url https://duendecodesigninghsm.vault.azure.net/ --azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 --azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 --azure-key-vault-client-secret ${{ secrets.SignClientSecret }} --azure-key-vault-certificate NuGetPackageSigning |
| 75 | + done |
| 76 | + - name: Push packages to GitHub |
| 77 | + run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/DuendeSoftware/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + - name: Upload Artifacts |
| 82 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 |
| 83 | + with: |
| 84 | + name: artifacts |
| 85 | + path: memory-cache/artifacts/*.nupkg |
| 86 | + overwrite: true |
| 87 | + retention-days: 15 |
| 88 | + publish: |
| 89 | + name: Publish to nuget.org |
| 90 | + needs: |
| 91 | + - tag |
| 92 | + runs-on: ubuntu-latest |
| 93 | + environment: |
| 94 | + name: nuget.org |
| 95 | + steps: |
| 96 | + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 |
| 97 | + with: |
| 98 | + name: artifacts |
| 99 | + path: artifacts |
| 100 | + - name: Setup Dotnet |
| 101 | + uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d |
| 102 | + with: |
| 103 | + dotnet-version: 10.0.100 |
| 104 | + - name: List files |
| 105 | + run: tree |
| 106 | + shell: bash |
| 107 | + - name: Push packages to nuget.org |
| 108 | + run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate |
0 commit comments