This commit is contained in:
GrantBirki 2023-08-29 13:51:01 -06:00
Родитель d9d78c8705
Коммит f9a6b13c97
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9029BBCCC15C6F8C
1 изменённых файлов: 61 добавлений и 0 удалений

61
.github/workflows/release.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,61 @@
name: release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- lib/version.rb
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # pin@v1.152.0
with:
bundler-cache: true
- name: bootstrap
run: script/bootstrap
- name: lint
run: bundle exec rubocop -c .rubocop.yml lib/ spec/
- name: test
run: script/test
- name: set GEM_NAME from gemspec
run: echo "GEM_NAME=$(ls | grep gemspec | cut -d. -f1)" >> $GITHUB_ENV
# builds the gem and saves the version to GITHUB_ENV
- name: build
run: echo "GEM_VERSION=$(gem build ${{ env.GEM_NAME }}.gemspec 2>&1 | grep Version | cut -d':' -f 2 | tr -d " \t\n\r")" >> $GITHUB_ENV
- name: publish to GitHub packages
run: |
export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
GEM_HOST_API_KEY=${{ secrets.GITHUB_TOKEN }} gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem
- name: release
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # pin@v1.12.0
with:
artifacts: "${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem"
tag: "v${{ env.GEM_VERSION }}"
generateReleaseNotes: true
- name: Publish to RubyGems
run: |
mkdir -p ~/.gem
echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials
gem push ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem
rm ~/.gem/credentials