From 9702431d2482a8569e942f5942ec5c40d137716c Mon Sep 17 00:00:00 2001 From: Rei Date: Wed, 26 Jul 2023 16:54:38 +0800 Subject: [PATCH] Add release github action --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ .github/workflows/{ci.yml => test.yml} | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml rename .github/workflows/{ci.yml => test.yml} (97%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4a30066 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + release: + types: [published] + +jobs: + build_and_push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + - run: bundle exec rake + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials + gem build *.gemspec + gem push *.gem + env: + RUBYGEMS_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}" diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 97% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 001c979..90729ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CI +name: Test on: [push, pull_request]