Skip to content

Merge pull request #327 from fac/dependabot/bundler/aws-dependencies-… #777

Merge pull request #327 from fac/dependabot/bundler/aws-dependencies-…

Merge pull request #327 from fac/dependabot/bundler/aws-dependencies-… #777

Workflow file for this run

name: Gem Build and Release
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # bundle install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Setup Poetry # Required for testing but not for building the gem.
uses: abatilo/actions-poetry@v2.4.0
with:
poetry-version: "1.1.13"
- run: bundle install
- run: bundle exec rake test
release:
name: Gem / Release
needs: test # Only release IF the tests pass
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release-gem.outputs.pushed-version }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: fac/ruby-gem-setup-credentials-action@v2
with:
token: ${{ secrets.github_token }}
- name: Build Gem
run: bundle exec rake build
# Release production gem version from default branch
- name: Release Gem
id: release-gem
if: ${{ github.ref == 'refs/heads/main' }}
uses: fac/ruby-gem-push-action@v2
with:
key: github
# PR branch builds will release pre-release gems
- name: Pre-Release Gem
if: ${{ github.ref != 'refs/heads/main' }}
uses: fac/ruby-gem-push-action@v2
with:
key: github
pre-release: true
# Trigger the "Push to Github Container Registry" workflow manually,
# since events triggered by the GITHUB_TOKEN don’t trigger other workflows:
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
trigger-ghcr-push:
name: Trigger container push to GHCR
runs-on: ubuntu-latest
needs: release
if: ${{needs.release.outputs.version}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: gh workflow --repo ${{ github.repository }} run "Push to Github Container Registry" -f version=${{needs.release.outputs.version}}