Skip to content

Update types

Update types #43

Workflow file for this run

# This file is based on:
# https://github.com/oxidize-rb/cross-gem-action
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
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
- id: fetch
uses: oxidize-rb/actions/fetch-ci-data@v1
with:
supported-ruby-platforms: |
exclude:
- x64-mingw32
- x64-mingw-ucrt
- arm-linux
- x86_64-linux-musl
stable-ruby-versions: |
exclude: [head, "3.1"]
cross-gem:
name: Compile native gem
runs-on: ubuntu-latest
needs: ci-data
strategy:
fail-fast: false
matrix:
ruby-platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.3"
bundler-cache: false
cargo-cache: true
cargo-vendor: true
cache-version: v1-${{ matrix.ruby-platform }}
- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.ruby-platform }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ', ') }}
- name: Smoke gem install
if: matrix.ruby-platform == 'x86_64-linux' # GitHub actions architecture
run: |
gem install pkg/mayu-css-*-x86_64-linux.gem --verbose
script="puts Mayu::CSS.transform('f','a{color:rgb(50,32,52);}').code"
ruby -rmayu/css -e "$script" | grep "color:#322034"
echo "✅ Successfully gem installed"
- name: Display structure of built gems
run: ls -R
working-directory: pkg/
- uses: actions/upload-artifact@v4
with:
name: cross-gem
path: ${{ steps.cross-gem.outputs.gem-path }}
release:
name: Release
needs: cross-gem
runs-on: ubuntu-latest
environment: rubygems
steps:
- uses: actions/checkout@v3
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
platform: ${{ matrix.ruby-platform }}
ruby-version: "3.3"
bundler-cache: true
cargo-cache: true
cache-version: v1
- name: Ensure version matches the tag
run: |
GEM_VERSION=$(grep VERSION lib/mayu/css/version.rb | head -n 1 | cut -d'"' -f2)
if [ "v$GEM_VERSION" != "${{ github.ref_name }}" ]; then
echo "Gem version does not match tag"
echo " v$GEM_VERSION != ${{ github.ref_name }}"
exit 1
fi
- uses: actions/download-artifact@v4
with:
name: cross-gem
path: pkg/
- name: Package source gem
run: bundle exec rake gem
- name: Push Gem
working-directory: pkg/
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_KEY }}
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
ls -l
for i in *.gem; do
if [ -f "$i" ]; then
if ! gem push "$i" >push.out; then
gemerr=$?
sed 's/^/::error:: /' push.out
if ! grep -q "Repushing of gem" push.out; then
exit $gemerr
fi
fi
fi
done