From cd1a8e1288647cabcdfca3a7a0035a16fde3fa6a Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 14:20:54 -0700 Subject: [PATCH 1/3] Add ruby release action --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69c019c6..9cca14ed8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,5 @@ +name: CI + on: push: branches: [ master ] @@ -17,6 +19,23 @@ jobs: - name: rubocop run: bundle install && bundle exec rake rubocop + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + - name: Build + run: bundle install && gem build stripe.gemspec + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: gems + path: '*.gem' + test: runs-on: ubuntu-latest strategy: @@ -32,3 +51,23 @@ jobs: run: docker run -d -p 12111-12112:12111-12112 stripe/stripe-mock && sleep 5 - name: test run: bundle install && bundle exec rake test + + publish: + name: Publish + #if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe')) + needs: [build, test, lint] + runs-on: ubuntu-latest + steps: + - name: Download all workflow run artifacts + uses: actions/download-artifact@v2 + with: + name: gems + path: gems + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + - name: Publish NuGet packages to NuGet + run: gem push gems/*.gem + env: + GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}} From a0a5925462d0b0781a751fcb29d810d2b03051fa Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Apr 2022 14:24:48 -0700 Subject: [PATCH 2/3] remove lint step --- .github/workflows/ci.yml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cca14ed8..bb69794b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,24 +1,13 @@ name: CI on: + workflow_dispatch: {} push: branches: [ master ] pull_request: branches: [ master ] jobs: - lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - - name: rubocop - run: bundle install && bundle exec rake rubocop - build: runs-on: ubuntu-latest @@ -28,8 +17,10 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 3.1 + - name: Lint + run: bundle install && bundle exec rake rubocop - name: Build - run: bundle install && gem build stripe.gemspec + run: gem build stripe.gemspec - name: 'Upload Artifact' uses: actions/upload-artifact@v2 with: @@ -55,7 +46,7 @@ jobs: publish: name: Publish #if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe')) - needs: [build, test, lint] + needs: [build, test] runs-on: ubuntu-latest steps: - name: Download all workflow run artifacts From 8b2f74afe30148a6239e0bb111e7894a5c81b558 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 28 Apr 2022 09:30:53 -0700 Subject: [PATCH 3/3] fb --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb69794b1..1e7b745f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: workflow_dispatch: {} push: branches: [ master ] + tags: + - v[0-9]+.[0-9]+.[0-9]+* pull_request: branches: [ master ] @@ -45,7 +47,7 @@ jobs: publish: name: Publish - #if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe')) + if: (((github.event_name == 'workflow_dispatch')) && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) && endsWith(github.actor, '-stripe')) needs: [build, test] runs-on: ubuntu-latest steps: @@ -58,7 +60,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 3.1 - - name: Publish NuGet packages to NuGet + - name: Publish gems to Rubygems run: gem push gems/*.gem env: GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}}