| 
 | 1 | +name: "Release"  | 
 | 2 | +run-name: "Release for ${{ github.ref }}"  | 
 | 3 | + | 
 | 4 | +on:  | 
 | 5 | +  workflow_dispatch:  | 
 | 6 | +    inputs:  | 
 | 7 | +      dry_run:  | 
 | 8 | +        description: Is this a dry run?  | 
 | 9 | +        required: true  | 
 | 10 | +        default: true  | 
 | 11 | +        type: boolean  | 
 | 12 | + | 
 | 13 | +env:  | 
 | 14 | +  RELEASE_MESSAGE_TEMPLATE: |  | 
 | 15 | +    Version {0} of [Ruby Kerberos Authentication for MongoDB](https://rubygems.org/gems/mongo_kerberos) is now available.  | 
 | 16 | +
  | 
 | 17 | +    **Release Highlights**  | 
 | 18 | +
  | 
 | 19 | +    TODO: one or more paragraphs describing important changes in this release  | 
 | 20 | +
  | 
 | 21 | +    **Installation**  | 
 | 22 | +
  | 
 | 23 | +    You may install this version via RubyGems, with:  | 
 | 24 | +
  | 
 | 25 | +    gem install --version {0} mongo_kerberos  | 
 | 26 | +
  | 
 | 27 | +permissions:  | 
 | 28 | +  # required for all workflows  | 
 | 29 | +  security-events: write  | 
 | 30 | + | 
 | 31 | +  # required to fetch internal or private CodeQL packs  | 
 | 32 | +  packages: read  | 
 | 33 | + | 
 | 34 | +  # only required for workflows in private repositories  | 
 | 35 | +  actions: read  | 
 | 36 | +  contents: write  | 
 | 37 | + | 
 | 38 | +  # required by the mongodb-labs/drivers-github-tools/setup@v2 step  | 
 | 39 | +  # also required by `rubygems/release-gem`  | 
 | 40 | +  id-token: write  | 
 | 41 | + | 
 | 42 | +jobs:  | 
 | 43 | +  build:  | 
 | 44 | +    name: "Build Gems"  | 
 | 45 | +    runs-on: ubuntu-latest  | 
 | 46 | +    strategy:  | 
 | 47 | +      fail-fast: false  | 
 | 48 | +      matrix:  | 
 | 49 | +        ruby: [ '3.2', jruby ]  | 
 | 50 | +    steps:  | 
 | 51 | +      - name: Check out the repository  | 
 | 52 | +        uses: actions/checkout@v4  | 
 | 53 | + | 
 | 54 | +      - name: Setup Ruby  | 
 | 55 | +        uses: ruby/setup-ruby@v1  | 
 | 56 | +        with:  | 
 | 57 | +          ruby-version: ${{ matrix.ruby }}  | 
 | 58 | +          bundler-cache: true  | 
 | 59 | + | 
 | 60 | +      - name: Set output gem file name  | 
 | 61 | +        shell: bash  | 
 | 62 | +        run: |  | 
 | 63 | +          echo "GEM_FILE_NAME=$(bundle exec rake gem_file_name)" >> "$GITHUB_ENV"  | 
 | 64 | +
  | 
 | 65 | +      - name: Build the gem  | 
 | 66 | +        shell: bash  | 
 | 67 | +        run: bundle exec rake build  | 
 | 68 | + | 
 | 69 | +      - name: Save the generated gem file for later  | 
 | 70 | +        uses: actions/upload-artifact@v4  | 
 | 71 | +        with:  | 
 | 72 | +          name: ${{ env.GEM_FILE_NAME }}  | 
 | 73 | +          path: ${{ env.GEM_FILE_NAME }}  | 
 | 74 | +          retention-days: 1  | 
 | 75 | +          overwrite: true  | 
 | 76 | + | 
 | 77 | +  publish:  | 
 | 78 | +    name: Publish Gems  | 
 | 79 | +    needs: build  | 
 | 80 | +    environment: release  | 
 | 81 | +    runs-on: ubuntu-latest  | 
 | 82 | +    steps:  | 
 | 83 | +      - name: Check out the repository  | 
 | 84 | +        uses: mongodb-labs/drivers-github-tools/secure-checkout@v2  | 
 | 85 | +        with:  | 
 | 86 | +          app_id: ${{ vars.APP_ID }}  | 
 | 87 | +          private_key: ${{ secrets.APP_PRIVATE_KEY }}  | 
 | 88 | + | 
 | 89 | +      - name: Setup Ruby  | 
 | 90 | +        uses: ruby/setup-ruby@v1  | 
 | 91 | +        with:  | 
 | 92 | +          ruby-version: '3.2'  | 
 | 93 | +          bundler-cache: true  | 
 | 94 | + | 
 | 95 | +      - name: Get the release version  | 
 | 96 | +        shell: bash  | 
 | 97 | +        run: echo "RELEASE_VERSION=$(bundle exec rake version)" >> "$GITHUB_ENV"  | 
 | 98 | + | 
 | 99 | +      - name: Setup GitHub tooling for DBX Drivers  | 
 | 100 | +        uses: mongodb-labs/drivers-github-tools/setup@v2  | 
 | 101 | +        with:  | 
 | 102 | +          aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}  | 
 | 103 | +          aws_region_name: ${{ vars.AWS_REGION_NAME }}  | 
 | 104 | +          aws_secret_id: ${{ secrets.AWS_SECRET_ID }}  | 
 | 105 | + | 
 | 106 | +      - name: Fetch the gem artifacts  | 
 | 107 | +        uses: actions/download-artifact@v4  | 
 | 108 | +        with:  | 
 | 109 | +          merge-multiple: true  | 
 | 110 | + | 
 | 111 | +      - name: Sign the gems  | 
 | 112 | +        uses: mongodb-labs/drivers-github-tools/gpg-sign@v2  | 
 | 113 | +        with:  | 
 | 114 | +          filenames: '*.gem'  | 
 | 115 | + | 
 | 116 | +      - name: Generate SSDLC Reports  | 
 | 117 | +        uses: mongodb-labs/drivers-github-tools/full-report@v2  | 
 | 118 | +        with:  | 
 | 119 | +          product_name: Mongo Kerberos for Ruby  | 
 | 120 | +          release_version: ${{ env.RELEASE_VERSION }}  | 
 | 121 | +          dist_filenames: '*.gem'  | 
 | 122 | +          silk_asset_group: mongo-ruby-kerberos  | 
 | 123 | + | 
 | 124 | +      - name: Create the tag  | 
 | 125 | +        uses: mongodb-labs/drivers-github-tools/tag-version@v2  | 
 | 126 | +        with:  | 
 | 127 | +          version: ${{ env.RELEASE_VERSION }}  | 
 | 128 | +          tag_template: "v${VERSION}"  | 
 | 129 | +          tag_message_template: "Release tag for v${VERSION}"  | 
 | 130 | + | 
 | 131 | +      - name: Create a new release  | 
 | 132 | +        shell: bash  | 
 | 133 | +        run: gh release create v${{ env.RELEASE_VERSION }} --title ${{ env.RELEASE_VERSION }} --generate-notes --draft  | 
 | 134 | + | 
 | 135 | +      - name: Capture the changelog  | 
 | 136 | +        shell: bash  | 
 | 137 | +        run: gh release view v${{ env.RELEASE_VERSION }} --json body --template '{{ .body }}' >> changelog  | 
 | 138 | + | 
 | 139 | +      - name: Prepare release message  | 
 | 140 | +        shell: bash  | 
 | 141 | +        run: |  | 
 | 142 | +          echo "${{ format(env.RELEASE_MESSAGE_TEMPLATE, env.RELEASE_VERSION) }}" > release-message  | 
 | 143 | +          cat changelog >> release-message  | 
 | 144 | +
  | 
 | 145 | +      - name: Update release information  | 
 | 146 | +        shell: bash  | 
 | 147 | +        run: |  | 
 | 148 | +          echo "RELEASE_URL=$(gh release edit v${{ env.RELEASE_VERSION }} --notes-file release-message)" >> "$GITHUB_ENV"  | 
 | 149 | +
  | 
 | 150 | +      - name: Upload release artifacts  | 
 | 151 | +        shell: bash  | 
 | 152 | +        run: gh release upload v${{ env.RELEASE_VERSION }} *.gem ${{ env.RELEASE_ASSETS }}/*.sig  | 
 | 153 | + | 
 | 154 | +      - name: Upload S3 assets  | 
 | 155 | +        uses: mongodb-labs/drivers-github-tools/upload-s3-assets@v2  | 
 | 156 | +        with:  | 
 | 157 | +          version: ${{ env.RELEASE_VERSION }}  | 
 | 158 | +          product_name: mongo-ruby-kerberos  | 
 | 159 | +          dry_run: ${{ inputs.dry_run }}  | 
 | 160 | + | 
 | 161 | +      - name: Publish the gems  | 
 | 162 | +        uses: rubygems/release-gem@v1  | 
 | 163 | +        if: inputs.dry_run == 'false'  | 
 | 164 | +        with:  | 
 | 165 | +          await-release: false  | 
0 commit comments