Skip to content

Commit

Permalink
GHA workflow deprecations updates (#66)
Browse files Browse the repository at this point in the history
* Replace deprecated create-release@v1
* Convert the remaining ::set-output GHA workflows

The patch enforces a standardized asset baseline using simp/puppetsync,
and may also apply other updates to ensure conformity.

Co-authored-by: Rick Gardner <[email protected]>
  • Loading branch information
rgardner4012 and Rick Gardner authored Apr 20, 2023
1 parent 8cabb60 commit 1d78656
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions .github/workflows/tag_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ on:
- '[0-9]+\.[0-9]+\.[0-9]+\-[a-z]+[0-9]+'

env:
PUPPET_VERSION: '~> 6'
PUPPET_VERSION: '~> 7'

jobs:
releng-checks:
Expand All @@ -55,7 +55,7 @@ jobs:
clean: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
ruby-version: 2.7
bundler-cache: true
- run: bundle exec rake pkg:check_version
- run: bundle exec rake pkg:compare_latest_tag
Expand All @@ -72,6 +72,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
prerelease: ${{ steps.tag-check.outputs.prerelease }}
tag: ${{ steps.tag-check.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -99,30 +100,29 @@ jobs:
echo "tag=$tag" | tee -a "$GITHUB_OUTPUT"
echo "prerelease=$prerelease" | tee -a "$GITHUB_OUTPUT"
echo "annotation_title=$annotation_title" | tee -a "$GITHUB_OUTPUT"
echo "TARGET_TAG=$tag" | tee -a "$GITHUB_ENV"
# Prepare annotation body as a file for the next step
#
# * The GitHub Release renders the text in this file as markdown
# * The file is needed because GITHUB_OUTPUT only supports single lines
# * The `perl -pe` removes RPM-style date headers from the CHANGELOG,
# because they don't render well as markdown on the Release page
#
echo "RELEASE_MESSAGE<<EOF$$" >> "$GITHUB_ENV"
printf '%s\n\n' "$annotation_title" >> "$GITHUB_ENV"
echo "$annotation" | tail -n +2 | \
perl -pe 'BEGIN{undef $/;} s/\n\* (Mon|Tue|Wed|Thu|Fri|Sat|Sun) .*?\n//smg;' > /tmp/annotation.body
perl -pe 'BEGIN{undef $/;} s/\n\* (Mon|Tue|Wed|Thu|Fri|Sat|Sun) .*?\n//smg;' >> "$GITHUB_ENV"
echo "EOF$$" >> "$GITHUB_ENV"
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.tag-check.outputs.annotation_title }}
body_path: /tmp/annotation.body
prerelease: ${{ steps.tag-check.outputs.prerelease == 'yes'}}
draft: false
run: |
echo "${RELEASE_MESSAGE}" > /tmp/.commit-msg.txt
args=(--file /tmp/.commit-msg.txt)
[[ ${{ steps.tag-check.outputs.prerelease }} == yes ]] && args+=(--prerelease)
hub release create ${args[@]} "$TARGET_TAG"
build-and-attach-rpms:
name: Trigger RPM release
Expand All @@ -137,16 +137,11 @@ jobs:
- centos7
- centos8
steps:
- name: Get tag & annotation info (${{github.ref}})
id: tag-check
run: |
tag="${GITHUB_REF/refs\/tags\//}"
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Trigger RPM release workflow (${{ matrix.os }})
uses: actions/github-script@v6
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
TARGET_TAG: ${{ steps.tag-check.outputs.tag }}
TARGET_TAG: ${{ needs.create-github-release.outputs.tag }}
with:
github-token: ${{ secrets.SIMP_AUTO_GITHUB_TOKEN__REPO_SCOPE }}
script: |
Expand Down Expand Up @@ -184,7 +179,7 @@ jobs:
clean: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
ruby-version: 2.7
bundler-cache: true
- name: Build Puppet module (PDK)
run: bundle exec pdk build --force
Expand Down

0 comments on commit 1d78656

Please sign in to comment.