mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
117 lines
3.6 KiB
YAML
117 lines
3.6 KiB
YAML
name: Release Gem
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
validate-release:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'puppetlabs/vmpooler'
|
|
outputs:
|
|
cv: ${{ steps.cv.outputs.version }}
|
|
nv: ${{ steps.nv.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Ruby 3.1
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 'ruby-3.1'
|
|
|
|
- name: Get Current Version
|
|
uses: actions/github-script@v6
|
|
id: cv
|
|
with:
|
|
script: |
|
|
const { data: response } = await github.rest.repos.getLatestRelease({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
})
|
|
console.log(`The latest release is ${response.tag_name}`)
|
|
return response.tag_name
|
|
result-encoding: string
|
|
|
|
- name: Get Next Version
|
|
id: nv
|
|
run: |
|
|
version=$(grep VERSION lib/vmpooler/version.rb |rev |cut -d "'" -f2 |rev)
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|
|
echo "Found version $version from lib/vmpooler/version.rb"
|
|
|
|
- name: Generate Changelog
|
|
run : |
|
|
gem install github_changelog_generator -v '~> 1.15.2'
|
|
CONSOLE_LEVEL=debug github_changelog_generator --future-release ${{ steps.nv.outputs.version }}
|
|
env:
|
|
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Validate Changelog
|
|
run : |
|
|
set -e
|
|
if [[ -n $(git status --porcelain) ]]; then
|
|
echo "Here is the current git status:"
|
|
git status
|
|
echo
|
|
echo "The following changes were detected:"
|
|
git --no-pager diff
|
|
echo "Uncommitted PRs found in the changelog. Please submit a release prep PR of changes after running `./update-changelog`"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Generate Release Notes
|
|
run : |
|
|
github_changelog_generator \
|
|
--since-tag ${{ steps.cv.outputs.result }} \
|
|
--future-release ${{ steps.nv.outputs.version }} \
|
|
--output release-notes.md
|
|
env:
|
|
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: release-notes
|
|
path: release-notes.md
|
|
|
|
publish-release:
|
|
runs-on: ubuntu-latest
|
|
needs: validate-release
|
|
if: github.repository == 'puppetlabs/vmpooler'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: release-notes
|
|
path: release-notes.md
|
|
|
|
- name: Test Outputs
|
|
run : |
|
|
cat release-notes.md
|
|
echo ${{ needs.validate-release.outputs.nv.version }}
|
|
|
|
# - name: Tag Release
|
|
# uses: ncipollo/release-action@v1
|
|
# with:
|
|
# tag: ${{ needs.validate-release.outputs.nv.version }}
|
|
# token: ${{ secrets.GITHUB_TOKEN }}
|
|
# bodyfile: release-notes.md
|
|
# draft: false
|
|
# prerelease: false
|
|
|
|
# # This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
|
|
# - name: Install Ruby jruby-9.4.3.0
|
|
# uses: ruby/setup-ruby@v1
|
|
# with:
|
|
# ruby-version: 'jruby-9.4.3.0'
|
|
|
|
# - name: Build gem
|
|
# run: gem build *.gemspec
|
|
|
|
# - name: Publish gem
|
|
# run: |
|
|
# mkdir -p $HOME/.gem
|
|
# touch $HOME/.gem/credentials
|
|
# chmod 0600 $HOME/.gem/credentials
|
|
# printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
# gem push *.gem
|
|
# env:
|
|
# GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
|