-
Notifications
You must be signed in to change notification settings - Fork 23
80 lines (66 loc) · 2.28 KB
/
Copy pathrelease.yml
File metadata and controls
80 lines (66 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: "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"
type: "string"
jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
if: github.repository_owner == 'puppetlabs'
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
ref: ${{ github.event.inputs.target }}
clean: true
fetch-depth: 0
- name: "Setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "3.1"
bundler-cache: "true"
- name: "Bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "Get version"
id: "get_version"
run: |
echo "version=$(ruby -e "require './lib/puppet_editor_services/version'; puts PuppetEditorServices::PUPPETEDITORSERVICESVERSION.to_s")" >> $GITHUB_OUTPUT
- name: "Build"
run: |
bundle exec rake build
- name: "Generate release notes"
run: |
export GH_HOST=github.com
gh extension install chelnak/gh-changelog
gh changelog get --latest > OUTPUT.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Create release"
run: |
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