From 19157caa5290c931a9c32d63951af2614dc2622c Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Mon, 29 Jul 2024 16:20:02 +0100 Subject: [PATCH 1/2] (BUG) - fix gem release workflow --- .github/workflows/gem_release.yml | 16 ---------------- .github/workflows/release.yml | 22 +++++++++++++++++++++- .gitignore | 1 + Rakefile | 7 ++++++- 4 files changed, 28 insertions(+), 18 deletions(-) delete mode 100644 .github/workflows/gem_release.yml diff --git a/.github/workflows/gem_release.yml b/.github/workflows/gem_release.yml deleted file mode 100644 index 59378d5b..00000000 --- a/.github/workflows/gem_release.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Gem Release" - -on: - workflow_dispatch: - inputs: - target: - description: "The target for the release. This can be a commit sha or a branch." - required: false - default: "main" - -jobs: - release: - uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release.yml@main" - with: - target: "${{ github.event.inputs.target }}" - secrets: "inherit" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5b0b34e..06ba30fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,6 +55,26 @@ jobs: - name: "Create release" run: | - gh release create v${{ steps.get_version.outputs.version }} ./output/* --title v${{ steps.get_version.outputs.version }} -F OUTPUT.md + gh release create v${{ steps.get_version.outputs.version }} ./pkg/* --title v${{ steps.get_version.outputs.version }} -F OUTPUT.md env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: "Publish gem to rubygems" + run: | + gem push ./pkg/*.gem + env: + GEM_HOST_API_KEY: '${{ secrets.GEM_HOST_API_KEY }}' + + - name: "Publish to GitHub Package" + run: | + echo "Setting up access to RubyGems" + mkdir -p ~/.gem + touch ~/.gem/credentials + chmod 600 ~/.gem/credentials + + echo "Logging in to GitHub Package Registry" + echo "---" > ~/.gem/credentials + echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials + + echo "Pushing gem to GitHub Package Registry" + gem push --key "github" --host "https://rubygems.pkg.github.com/${{github.repository_owner}}" ./pkg/*.gem diff --git a/.gitignore b/.gitignore index 10306e72..cd9fa04e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ log/ tmp/ output/ vendor/ +pkg/ diff --git a/Rakefile b/Rakefile index 83192151..95510713 100644 --- a/Rakefile +++ b/Rakefile @@ -149,7 +149,7 @@ task build: [:gem_revendor] do require 'digest' project_dir = File.dirname(__FILE__) - output_dir = File.join(project_dir, 'output') + output_dir = File.join(project_dir, './pkg/') file_list = ['lib', 'vendor', 'puppet-languageserver', 'puppet-debugserver', 'puppet-languageserver-sidecar', 'LICENSE'] # Remove files in the list that do not exist. @@ -180,6 +180,11 @@ task build: [:gem_revendor] do File.open(filepath + '.sha256', 'wb') { |file| file.write(sha) } end puts "Created checksums" + + puts 'Building gem..' + require 'bundler/gem_tasks' + Rake::Task['build'].invoke + puts 'Gem built' end task :default => [:test] From ac27b6648a44a31367301cc368ccecb1da086678 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Mon, 29 Jul 2024 16:20:23 +0100 Subject: [PATCH 2/2] (maint) - Add stricter dependency reqs --- puppet-editor-services.gemspec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/puppet-editor-services.gemspec b/puppet-editor-services.gemspec index 6332be62..f736b1b4 100644 --- a/puppet-editor-services.gemspec +++ b/puppet-editor-services.gemspec @@ -20,10 +20,10 @@ Gem::Specification.new do |s| 'bin/*', '[A-Z]*'].to_a s.license = 'Apache-2.0' - s.add_runtime_dependency 'puppet-lint' - s.add_runtime_dependency 'hiera-eyaml' - s.add_runtime_dependency 'puppetfile-resolver' - s.add_runtime_dependency 'molinillo' - s.add_runtime_dependency 'puppet-strings' - s.add_runtime_dependency 'yard' + s.add_runtime_dependency 'puppet-lint', '~> 4.0' + s.add_runtime_dependency 'hiera-eyaml', '~> 2.1' + s.add_runtime_dependency 'puppetfile-resolver', '~> 0.6' + s.add_runtime_dependency 'molinillo', '~> 0.6' + s.add_runtime_dependency 'puppet-strings', '~> 4.0' + s.add_runtime_dependency 'yard', '~> 0.9' end