-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from alphagov/ldeb-use-github-actions
Replace Travis CI with GitHub Actions
- Loading branch information
Showing
4 changed files
with
88 additions
and
2,518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.