Sha256: ee6a119f51bb9b52fc093f784ab49998f9d1dbe22c6bd2e72e3df152bd4dc7c5

Contents?: true

Size: 1.68 KB

Versions: 61

Compression:

Stored size: 1.68 KB

Contents

name: Publish RubyGem and GitHub release

on:
  push:
    branches: [main]

jobs:
  publish:
    runs-on: ubuntu-latest
    name: Publish RubyGem and GitHub release
    steps:
      - uses: actions/checkout@v3

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.0.0

      - name: Get version
        id: version
        run: |
          VERSION=$(sed -n "s/.*VERSION = [\"']\(.*\)[\"'].*/\1/p" lib/stytch/version.rb)
          echo "version=$VERSION" >> $GITHUB_OUTPUT
          echo "release_tag=v$VERSION" >> $GITHUB_OUTPUT

      - name: Get changed files
        id: files
        uses: jitterbit/get-changed-files@v1

      - name: Check for config.rb diff
        id: diff
        run: |
          FOUND=0
          for changed_file in ${{ steps.files.outputs.all }}; do
            if [[ $changed_file == "lib/stytch/version.rb" ]]; then
              FOUND=1
            fi
          done
          echo "diff=$FOUND" >> $GITHUB_OUTPUT

      - name: Publish RubyGem
        if: steps.diff.outputs.diff != 0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
        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 build stytch.gemspec
          gem push "stytch-${{ steps.version.outputs.version }}.gem"

      - name: Create release
        if: steps.diff.outputs.diff != 0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: gh release create "${{ steps.version.outputs.release_tag }}" --generate-notes

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
stytch-10.9.0 .github/workflows/auto-publish.yml
stytch-10.8.0 .github/workflows/auto-publish.yml
stytch-10.7.0 .github/workflows/auto-publish.yml
stytch-10.6.0 .github/workflows/auto-publish.yml
stytch-10.5.0 .github/workflows/auto-publish.yml
stytch-10.4.0 .github/workflows/auto-publish.yml
stytch-10.2.1 .github/workflows/auto-publish.yml
stytch-10.1.1 .github/workflows/auto-publish.yml
stytch-10.0.2 .github/workflows/auto-publish.yml
stytch-10.0.1 .github/workflows/auto-publish.yml
stytch-9.12.2 .github/workflows/auto-publish.yml
stytch-9.12.1 .github/workflows/auto-publish.yml
stytch-9.11.2 .github/workflows/auto-publish.yml
stytch-10.3.1 .github/workflows/auto-publish.yml
stytch-10.3.0 .github/workflows/auto-publish.yml
stytch-10.2.0 .github/workflows/auto-publish.yml
stytch-10.1.0 .github/workflows/auto-publish.yml
stytch-10.0.0 .github/workflows/auto-publish.yml
stytch-9.12.0 .github/workflows/auto-publish.yml
stytch-9.11.1 .github/workflows/auto-publish.yml