Skip to content

Commit

Permalink
Update gem build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zyc9012 committed Dec 26, 2024
1 parent 4e8f731 commit 3a722b1
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/gem-push.yml → .github/workflows/gem-build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Publish Gem
name: Build Gem

on:
push:
tags:
- v**
on: [push, pull_request]

jobs:
build-ruby:
Expand Down Expand Up @@ -31,17 +28,9 @@ jobs:
with:
name: "ruby-gem"
path: "*.gem"
- name: Publish to RubyGems
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
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"

build-native:
needs: ['build-ruby']
strategy:
matrix:
platform: ['x86-mingw32', 'x64-mingw-ucrt', 'x64-mingw32', 'x86_64-linux', 'x86_64-darwin', 'arm64-darwin']
Expand All @@ -65,13 +54,27 @@ jobs:
with:
name: "${{ matrix.platform }}-gem"
path: pkg/*.gem
- name: Publish to RubyGems
shell: bash
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
gem push pkg/*.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"

publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: ['build-ruby', 'build-native']
strategy:
matrix:
platform: ['ruby', 'x86-mingw32', 'x64-mingw-ucrt', 'x64-mingw32', 'x86_64-linux', 'x86_64-darwin', 'arm64-darwin']
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: "${{ matrix.platform }}-gem"
- name: List files
run: ls -l pkg
# - name: Publish to RubyGems
# shell: bash
# 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
# gem push pkg/*.gem
# env:
# GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"

0 comments on commit 3a722b1

Please sign in to comment.