Sha256: 1cb842e28ef71e4046f710d7ce5dbe4f2921d5454c4d9225adb4eb1e76edca73

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

name: Deploy
on:
  push:
    tags:
      - '*'
  workflow_dispatch:

jobs:
  deploy:
    name: Deploy to Rubygems
    runs-on: ubuntu-latest
    steps:
      - name: Checkout twilio-ruby
        uses: actions/checkout@v2

      - name: Login to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_AUTH_TOKEN }}

      # The expression strips off the shortest match from the front of the string to yield just the tag name as the output
      - name: Get tagged version
        run: echo "GITHUB_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

      - name: Build and Push image
        run: make docker-build && make docker-push

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.4
          bundler-cache: true

      - run: bundle install
      - name: Publish to Rubygems
        env:
          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 *.gemspec
          gem push *.gem

  notify-on-failure:
    name: Slack notify on failure
    if: ${{ failure() }}
    needs: [deploy]
    runs-on: ubuntu-latest
    steps:
      - uses: rtCamp/action-slack-notify@v2
        env:
          SLACK_COLOR: ${{ needs.deploy.status }}
          SLACK_ICON_EMOJI: ':github:'
          SLACK_MESSAGE: ${{ format('Failed to publish {1} to RubyGems{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
          SLACK_TITLE: Deployment Failure
          SLACK_USERNAME: GitHub Actions
          SLACK_MSG_AUTHOR: twilio-dx
          SLACK_FOOTER: Posted automatically using GitHub Actions
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          MSG_MINIMAL: true

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twilio-ruby-5.61.0 .github/workflows/deploy.yml