Skip to content

Commit

Permalink
ci: enable GH actions to replace Travis CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphoting committed Sep 12, 2023
1 parent 9ac8551 commit a065856
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release
on:
push:
branches:
- "master" # main only

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
release-type: ruby
package-name: "pwqgen.rb"
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true
version-file: "lib/pwqgen/version.rb"

# Checkout code
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

# Setup ruby
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
if: ${{ steps.release.outputs.release_created }}
- name: Run tests
run: |
bundle exec rake test
if: ${{ steps.release.outputs.release_created }}

# Publish if release was created
- name: publish gem
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
bundle exec rake build
gem push pkg/*.gem
env:
# Make sure to update the secret name
# if yours isn't named RUBYGEMS_AUTH_TOKEN
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
if: ${{ steps.release.outputs.release_created }}

- name: Upload Release Artifact
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release upload ${{ steps.release.outputs.tag_name }} pkg/*.gem
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Run tests
on: [push, pull_request]

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run tests
run: |
bundle exec rake test
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

0 comments on commit a065856

Please sign in to comment.