mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
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:
55
.github/workflows/publish-gem-package.yml
vendored
Normal file
55
.github/workflows/publish-gem-package.yml
vendored
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user