Skip to content

Commit

Permalink
Merge pull request #247 from alphagov/shared-workflow
Browse files Browse the repository at this point in the history
Use shared workflow to publish gem
  • Loading branch information
kevindew authored Jul 27, 2022
2 parents 7ec082f + 1175bbf commit f63ddb7
Showing 1 changed file with 5 additions and 26 deletions.
31 changes: 5 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo "All matrix tests have passed 🚀"

release:
publish:
needs: test
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
rubygems: latest
- env:
GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }}
GEM_NAME: govuk_app_config
run: |
VERSION=$(ruby -e "puts eval(File.read('$GEM_NAME.gemspec')).version")
GEM_VERSION=$(gem list --exact --remote $GEM_NAME)
# Publish to RubyGems.org
if [ "${GEM_VERSION}" != "$GEM_NAME (${VERSION})" ]; then
gem build $GEM_NAME.gemspec
gem push "$GEM_NAME-${VERSION}.gem"
fi
# Create a release tag
if ! git ls-remote --tags --exit-code origin v${VERSION}; then
git tag v${VERSION}
git push --tags
fi
uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yaml@main
secrets:
GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }}

0 comments on commit f63ddb7

Please sign in to comment.