Sha256: 28de7efcc83e260a280d2ef6c04ed06b74d654d2d1786cdd67bc9820ddc3ff63

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

name: Tag Release & Push Gem

on: workflow_dispatch

jobs:
  release:
    name: Validate Docs, Tag, and Push Gem
    runs-on: ubuntu-latest
    if: github.repository == 'puppetlabs/beaker-answers'

    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      with:
        ref: ${{ github.ref }}
        clean: true
        fetch-depth: 0

    - name: Get New Version
      id: nv
      run: |
        version=$(grep STRING lib/beaker-answers/version.rb |rev |cut -d "'" -f2 |rev)
        echo "version=$version" >> $GITHUB_OUTPUT
        echo "Found version $version from lib/beaker-answers/version.rb"

    - name: Get Current Version
      uses: actions/github-script@v7
      id: cv
      with:
        script: |
          const { data: response } = await github.rest.repos.getLatestRelease({
            owner: context.repo.owner,
            repo: context.repo.repo,
          })
          console.log(`The latest release is ${response.tag_name}`)
          return response.tag_name
        result-encoding: string

    - name: Tag Release
      uses: ncipollo/release-action@v1
      with:
        tag: ${{ steps.nv.outputs.version }}
        token: ${{ secrets.GITHUB_TOKEN }}
        draft: false
        prerelease: false

    - name: Set up Ruby 2.7
      uses: actions/setup-ruby@v1
      with:
        version: 2.7.x

    - name: Build gem
      run: gem build *.gemspec

    - name: Publish gem
      run: |
        mkdir -p $HOME/.gem
        touch $HOME/.gem/credentials
        chmod 0600 $HOME/.gem/credentials
        printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
        gem push *.gem
      env:
        GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beaker-answers-1.0.0 .github/workflows/release.yml