Skip to content

Commit

Permalink
Create release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uvlad7 committed Oct 29, 2023
1 parent 2703210 commit c830dbe
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
workflow_dispatch:
push:
tags: [ "v*.*.*" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci-data:
runs-on: ubuntu-latest
name: CI Data
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
- name: Fetch CI Data
uses: oxidize-rb/actions/fetch-ci-data@v1
id: fetch
with:
supported-ruby-platforms: |
exclude: []
stable-ruby-versions: |
exclude: [head]
cross-gem:
name: Compile native gem for ${{ matrix.platform }}
runs-on: ubuntu-latest
needs: ci-data
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
ruby:
- "2.7.8"
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: "3.4.14"

- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}

- uses: actions/upload-artifact@v3
with:
name: cross-gem-${{ matrix.ruby-platform }}
path: ${{ steps.cross-gem.outputs.gem-path }}
if-no-files-found: error
retention-days: 1
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ gemspec = Gem::Specification.load("xml2json.gemspec")

RbSys::ExtensionTask.new("xml2json", gemspec) do |ext|
ext.lib_dir = "lib/xml2json"
ext.cross_compile = true
end

task :clippy do
Expand Down
6 changes: 5 additions & 1 deletion lib/xml2json.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# frozen_string_literal: true

require_relative "xml2json/version"
require_relative "xml2json/xml2json"
begin
require_relative "xml2json/#{RUBY_VERSION[/(\d+\.\d+)/, 1]}/xml2json"
rescue LoadError
require_relative "xml2json/xml2json"
end

# @see https://docs.rs/xml2json-rs/1.0.1/xml2json_rs/index.html docs for the wrapped library
module Xml2Json
Expand Down

0 comments on commit c830dbe

Please sign in to comment.