Sha256: 4931d3851b8f30494c20c8078cf4fd68271acabd27d18a249185457ed0cfc862

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

name: publish

on:
  workflow_run:
    workflows:
      - ci
    branches:
      - main
    types:
      - completed

jobs:
  publish:
    if: github.event.workflow_run.conclusion == 'success' #&& startsWith(github.ref, 'refs/tags/v')

    name: Publish Gem
    runs-on: ubuntu-18.04

    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby 2.6
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: 2.6
    - run: bundle install

    - name: Build and publish RubyGem
      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 && \
        echo "Gem published successfully!"

    - name: Update version file on CloudWebManage/cwm-worker-logger
      env:
        DEPLOY_KEY: ${{ secrets.CWM_WORKER_LOGGER_DEPLOY_KEY }}
        DEPLOY_KEY_FILE: cwm_worker_logger_deploy_key
        GEM_NAME: fluent-plugin-http-cwm
      run: |
        version=$(ruby -e 'puts Gem::Specification::load("fluent-plugin-http-cwm.gemspec").version') && \
        echo "Version: " $version && \
        echo "$DEPLOY_KEY" > $DEPLOY_KEY_FILE && \
        chmod 400 $DEPLOY_KEY_FILE && \
        export GIT_SSH_COMMAND="ssh -i $(pwd)/$DEPLOY_KEY_FILE -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" && \
        git clone git@github.com:CloudWebManage/cwm-worker-logger.git && \
        cd cwm-worker-logger && \
        git config user.name "$GEM_NAME CI" && \
        git config user.email "$GEM_NAME-ci@localhost" && \
        echo $version > $GEM_NAME.version && \
        git add $GEM_NAME.version && \
        git commit -m "Automatic version update for $GEM_NAME gem." && \
        git push origin main && \
        echo "Version updated successfully!"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-http-cwm-0.2.0 .github/workflows/publish.yml