Colex/gdpr_admin

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: Publish
on:
  workflow_run:
    workflows: ["Build"]
    branches: [master]
    types:
      - completed
jobs:
  publish:
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    steps:
      - uses: GoogleCloudPlatform/release-please-action@v2
        id: release
        with:
          release-type: ruby
          package-name: gdpr_admin
          version-file: "lib/gdpr_admin/version.rb"
      - uses: actions/checkout@v2
      - name: Set up Ruby 3.1
        uses: actions/setup-ruby@v1
        if: ${{ steps.release.outputs.release_created }}
        with:
          ruby-version: 3.1
      - name: Publish to GPR
        if: ${{ steps.release.outputs.release_created }}
        run: |
          mkdir -p $HOME/.gem
          touch $HOME/.gem/credentials
          chmod 0600 $HOME/.gem/credentials
          printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
          gem build *.gemspec
          gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
        env:
          GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
          OWNER: ${{ github.repository_owner }}
      - name: Publish to RubyGems
        if: ${{ steps.release.outputs.release_created }}
        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 *.gemspec
          gem push *.gem
        env:
          GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"