Skip to content

Commit fac507d

Browse files
authored
Merge pull request #3 from OpenVoxProject/github-automation
Sync automation from another OpenVoxProject repo
2 parents 1330d5d + 8432ce6 commit fac507d

6 files changed

Lines changed: 195 additions & 45 deletions

File tree

.github/dependabot.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
61
version: 2
72
updates:
8-
- package-ecosystem: "" # See documentation for possible values
9-
directory: "/" # Location of package manifests
3+
# raise PRs for gem updates
4+
- package-ecosystem: bundler
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
time: "13:00"
9+
open-pull-requests-limit: 10
10+
11+
# Maintain dependencies for GitHub Actions
12+
- package-ecosystem: github-actions
13+
directory: "/"
1014
schedule:
11-
interval: "weekly"
15+
interval: daily
16+
time: "13:00"
17+
open-pull-requests-limit: 10

.github/workflows/gem_release.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
name: Gem Release
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
permissions: {}
10+
11+
jobs:
12+
build-release:
13+
# Prevent releases from forked repositories
14+
if: github.repository_owner == 'OpenVoxProject'
15+
name: Build the gem
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: 'ruby'
23+
- name: Build gem
24+
shell: bash
25+
run: gem build --verbose *.gemspec
26+
- name: Upload gem to GitHub cache
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: gem-artifact
30+
path: '*.gem'
31+
retention-days: 1
32+
compression-level: 0
33+
34+
create-github-release:
35+
needs: build-release
36+
name: Create GitHub release
37+
runs-on: ubuntu-24.04
38+
permissions:
39+
contents: write # clone repo and create release
40+
steps:
41+
- name: Download gem from GitHub cache
42+
uses: actions/download-artifact@v4
43+
with:
44+
name: gem-artifact
45+
- name: Create Release
46+
shell: bash
47+
env:
48+
GH_TOKEN: ${{ github.token }}
49+
run: gh release create --repo ${{ github.repository }} ${{ github.ref_name }} --generate-notes *.gem
50+
51+
release-to-github:
52+
needs: build-release
53+
name: Release to GitHub
54+
runs-on: ubuntu-24.04
55+
permissions:
56+
packages: write # publish to rubygems.pkg.github.com
57+
steps:
58+
- name: Download gem from GitHub cache
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: gem-artifact
62+
- name: Publish gem to GitHub packages
63+
run: gem push --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
64+
env:
65+
GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}
66+
67+
release-to-rubygems:
68+
needs: build-release
69+
name: Release gem to rubygems.org
70+
runs-on: ubuntu-24.04
71+
environment: release # recommended by rubygems.org
72+
permissions:
73+
id-token: write # rubygems.org authentication
74+
steps:
75+
- name: Download gem from GitHub cache
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: gem-artifact
79+
- uses: rubygems/configure-rubygems-credentials@v1.0.0
80+
- name: Publish gem to rubygems.org
81+
shell: bash
82+
run: gem push *.gem
83+
84+
release-verification:
85+
name: Check that all releases are done
86+
runs-on: ubuntu-24.04
87+
permissions:
88+
contents: read # minimal permissions that we have to grant
89+
needs:
90+
- create-github-release
91+
- release-to-github
92+
- release-to-rubygems
93+
steps:
94+
- name: Download gem from GitHub cache
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: gem-artifact
98+
- name: Install Ruby
99+
uses: ruby/setup-ruby@v1
100+
with:
101+
ruby-version: 'ruby'
102+
- name: Wait for release to propagate
103+
shell: bash
104+
run: |
105+
gem install rubygems-await
106+
gem await *.gem

.github/workflows/mend.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Prepare Release'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to be released.'
8+
required: false
9+
default: ''
10+
type: string
11+
base-branch:
12+
description: 'The branch that will be used as the origin for the release branch.'
13+
required: false
14+
default: ''
15+
type: string
16+
17+
permissions: {}
18+
19+
jobs:
20+
prepare_release:
21+
uses: OpenVoxProject/shared-actions/.github/workflows/prepare_release.yml@main
22+
with:
23+
allowed_owner: 'OpenVoxProject'
24+
base-branch: ${{ github.event.inputs.base-branch }}
25+
version: ${{ github.event.inputs.version }}
26+
secrets:
27+
github_pat: ${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }}
28+
ssh_private_key: ${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }}

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Release'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to be released.'
8+
required: false
9+
default: ''
10+
type: string
11+
base-branch:
12+
description: 'The branch where we do this release.'
13+
required: false
14+
default: ''
15+
type: string
16+
17+
permissions: {}
18+
19+
jobs:
20+
release:
21+
uses: OpenVoxProject/shared-actions/.github/workflows/release.yml@main
22+
with:
23+
allowed_owner: 'OpenVoxProject'
24+
base-branch: ${{ github.event.inputs.base-branch }}
25+
version: ${{ github.event.inputs.version }}
26+
secrets:
27+
github_pat: ${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }}
28+
ssh_private_key: ${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }}

tasks/vox.rake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
namespace :vox do
4+
desc 'Update the version in preparation for a release'
5+
task 'version:bump:full', [:version] do |_, args|
6+
abort 'You must provide a tag.' if args[:version].nil? || args[:version].empty?
7+
version = args[:version]
8+
abort "#{version} does not appear to be a valid version string in x.y.z format" unless Gem::Version.correct?(version)
9+
10+
# Update lib/facter/version.rb and openvox.gemspec
11+
puts "Setting version to #{version}"
12+
13+
data = File.read('lib/puppetserver/ca/version.rb')
14+
new_data = data.sub(/VERSION = "\d+\.\d+\.\d+(\.rc\d+)?"/, %(VERSION = "#{version}"))
15+
warn 'Failed to update version in lib/facter/version.rb' if data == new_data
16+
17+
File.write('lib/puppetserver/ca/version.rb', new_data)
18+
end
19+
end

0 commit comments

Comments
 (0)