Skip to content

Commit

Permalink
Merge pull request #274 from alphagov/ldeb-use-github-actions
Browse files Browse the repository at this point in the history
Replace Travis CI with GitHub Actions
  • Loading branch information
lfdebrux authored Oct 21, 2021
2 parents 209a7ec + bb5dd07 commit 11c7dca
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 2,518 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish

on:
push:
branches:
- master
workflow_dispatch:

concurrency: rubygems

jobs:
deploy:
name: Publish Ruby Gem
environment: rubygems
permissions:
contents: write # needed to be able to tag the release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '14'

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Check if new version to release
id: gem_version
run: |
gem_version=$(ruby -r rubygems -e "puts Gem::Specification::load('govuk_tech_docs.gemspec)').version")
echo "::set-output name=gem_version::$gem_version"
if git fetch origin "refs/tags/v$gem_version" >/dev/null 2>&1
then
echo "Tag 'v$gem_version' already exists"
echo "::set-output name=new_version::false"
else
echo "::set-output name=new_version::true"
fi
- name: Publish
if: ${{ steps.gem_version.outputs.new_version == 'true' }}
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
mkdir -p ~/.gem
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
# tag will be associated with github-actions bot user, see
# https://github.community/t/github-actions-bot-email-address/17204
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
bundle exec rake release
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on: [push, pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Run tests
run: bundle exec rake
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 11c7dca

Please sign in to comment.