Skip to content

Update set-up-rubygems-credentials.sh #23

Update set-up-rubygems-credentials.sh

Update set-up-rubygems-credentials.sh #23

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup ruby and install deps
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
bundler: default
- name: Run lint
run: bundle exec rubocop
- name: Build plugin
run: bundle exec rake build
- name: Run tests
run: bundle exec rake test
- name: Capture version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Verify tag version matchs VERSION file
# Only run this test when run on a tag
if: startsWith(github.ref, 'refs/tags/v')
# Fail if the tag name does not match the version in the VERSION file.
run: test "${{ github.ref }}" == "refs/tags/v${{ env.VERSION }}"
- name: Login to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: scalyr
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
uses: docker/build-push-action@v4
with:
# set push to true when a tag is created
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
file: docker/Dockerfile
context: .
tags: |
scalyr/fluentd:latest
scalyr/fluentd:${{ env.VERSION }}
- name: Write RubyGems Credentials to a file
if: startsWith(github.ref, 'refs/tags/v')
run: ./scripts/set-up-rubygems-credentials.sh
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
- name: Publish package to RubyGems
if: startsWith(github.ref, 'refs/tags/v')
run: gem push pkg/fluent-plugin-scalyr-${{ env.VERSION }}.gem