Make code available as gem for test installs (#1629)

Make it possible for others to help validate vagrant-libvirt plugin
changes by building a gem that can be installed from a github packages
repository.
This commit is contained in:
Darragh Bailey
2022-10-05 00:11:00 +01:00
committed by GitHub
parent 28c68d2f99
commit 48c31f12b3

View File

@@ -0,0 +1,55 @@
name: publish-gem
on:
push:
branches:
- main
pull_request:
permissions:
packages: write
jobs:
build-package:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install rake & ruby
run: |
sudo apt-get install -y \
rake \
ruby \
;
- name: Build gem
run: |
rake build
- uses: actions/upload-artifact@v3
with:
name: gem
path: pkg/**.gem
publish-package:
needs: build-package
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v3
with:
name: gem
- name: setup credentials
run: |
mkdir ~/.gem
cat <<EOF > ~/.gem/credentials
---
:github: Bearer ${GITHUB_TOKEN}
EOF
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: publish package
run: |
gem push --key github \
--host https://rubygems.pkg.github.com/${GITHUB_REPOSITORY_OWNER} \
*.gem