mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-25 21:28:40 -05:00
Update workflow to check changelog, add release notes and docker push
This commit is contained in:
parent
dba1215db4
commit
9fdbb4acb9
1 changed files with 87 additions and 11 deletions
96
.github/workflows/release.yml
vendored
96
.github/workflows/release.yml
vendored
|
|
@ -1,32 +1,108 @@
|
||||||
name: Release
|
name: Tag Release & Push Gem & Docker
|
||||||
|
|
||||||
on: workflow_dispatch
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Build + Publish
|
name: Validate Docs, Tag, and Docker Push
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout code
|
||||||
- name: Get Version
|
uses: actions/checkout@v3
|
||||||
id: gv
|
with:
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
clean: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get New Version
|
||||||
|
id: nv
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=ver::$(grep VERSION lib/vmfloaty/version.rb |rev |cut -d "'" -f2 |rev)"
|
version=$(grep VERSION lib/vmfloaty/version.rb |rev |cut -d "'" -f2 |rev)
|
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
echo "Found version $version from lib/vmfloaty/version.rb"
|
||||||
|
|
||||||
|
- 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: Generate Changelog
|
||||||
|
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
|
||||||
|
with:
|
||||||
|
args: >-
|
||||||
|
--future-release ${{ steps.nv.outputs.version }}
|
||||||
|
env:
|
||||||
|
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Validate Changelog
|
||||||
|
run : |
|
||||||
|
set -e
|
||||||
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; 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 './release-prep ${{ steps.nv.outputs.version }}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate Release Notes
|
||||||
|
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
|
||||||
|
with:
|
||||||
|
args: >-
|
||||||
|
--since-tag ${{ steps.cv.outputs.result }}
|
||||||
|
--future-release ${{ steps.nv.outputs.version }}
|
||||||
|
--output release-notes.md
|
||||||
|
env:
|
||||||
|
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Tag Release
|
- name: Tag Release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
tag: ${{ steps.gv.outputs.ver }}
|
tag: ${{ steps.nv.outputs.version }}
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
bodyfile: release-notes.md
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
generateReleaseNotes: true
|
|
||||||
|
|
||||||
- name: Set up Ruby 2.7
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}:${{ steps.nv.outputs.version }}
|
||||||
|
ghcr.io/${{ github.repository }}:latest
|
||||||
|
|
||||||
|
- name: Set up Ruby 3.2
|
||||||
uses: actions/setup-ruby@v1
|
uses: actions/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
version: 2.7.x
|
version: 3.2.x
|
||||||
|
|
||||||
- name: Build gem
|
- name: Build gem
|
||||||
run: gem build *.gemspec
|
run: gem build *.gemspec
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue