Test Compatibility with newer Getopt::Long::Descriptive Versions #31
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish new Release | |
# only trigger on pull request closed events | |
on: | |
pull_request: | |
types: | |
- closed | |
workflow_dispatch: | |
branches: | |
- master | |
jobs: | |
publish_release: | |
# this job will only run if the PR has been merged | |
if: (github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch') | |
runs-on: ubuntu-20.04 | |
# Docker Hub image that `publish_release` executes in | |
# This will compile the release binary for Ubuntu Xenial | |
# container: ubuntu:xenial | |
steps: | |
- name: Check the Pull Request | |
if: github.event.pull_request != null | |
run: echo "Event '${{ github.event_name }}' - PR ${{ github.event.pull_request.number }} has been merged" | |
- name: Check for Manual Launch | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "Event '${{ github.event_name }}' - Manual Push to Registry" | |
- name: Install Perl Dependencies | |
run: | | |
perl --version | |
sudo apt-get update | |
sudo apt-get -y install git libextutils-makemaker-cpanfile-perl | |
sudo apt-get -y install libgetopt-long-descriptive-perl libcpan-uploader-perl libpath-tiny-perl | |
sudo apt-get -y install libcpanel-json-xs-perl libjson-xs-perl libjson-perl libdata-dump-perl | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Package Version | |
id: package_version | |
run: | | |
package_version_res=`scripts/package_version.pl` | |
echo -e "$package_version_res" | |
if [ -z "$package_version_res" ]; then echo "could not find PACKAGE VERSION"; exit 1; fi; | |
package_name=`echo "$package_version_res" | cut -d"=" -f1 | cut -d"@" -f1` | |
package_version=`echo "$package_version_res" | cut -d"=" -f2 | cut -d"@" -f1` | |
version_commit=`echo "$package_version_res" | cut -d"=" -f2 | cut -d"@" -f2` | |
version_tag="v$package_version" | |
echo "package=$package_name" >> $GITHUB_OUTPUT | |
echo "version=$version_tag" >> $GITHUB_OUTPUT | |
echo "version_commit=$version_commit" >> $GITHUB_OUTPUT | |
- name: Check Repository for Package Version Tag | |
id: git_tag | |
run: | | |
git fetch --tags | |
tag_label=`git tag -l "${{ steps.package_version.outputs.version }}"` | |
if [ -z $tag_label ]; then tag_exists=0; else tag_exists=1; fi; | |
echo "git - tag: '$tag_label'; exists: '$tag_exists'" | |
echo "tag=$tag_label" >> $GITHUB_OUTPUT | |
echo "exists=$tag_exists" >> $GITHUB_OUTPUT | |
- name: Tag the Repository with Package Version Tag | |
id: git_tag_set | |
if: steps.git_tag.outputs.exists == 0 | |
run: | | |
echo "git - tag: '${{ steps.git_tag.outputs.tag }}'; exists: '${{ steps.git_tag.outputs.exists }}'" | |
echo "git - commit: '${{ steps.package_version.outputs.version_commit }}'" | |
find_commit_res=`scripts/find_version_commit.pl "${{ steps.package_version.outputs.version_commit }}"` || true | |
echo -e "$find_commit_res" | |
find_commit_res=`echo "$find_commit_res" | grep -i " by "` | |
if [ -z "$find_commit_res" ]; then echo "could not find GIT VERSION COMMIT"; exit 1; fi; | |
merge_commit=`echo "$find_commit_res" | cut -d' ' -f1 | cut -d'/' -f2` | |
merge_user=`echo "$find_commit_res" | cut -d"'" -f2 | cut -d'/' -f1` | |
merge_email=`echo "$find_commit_res" | cut -d"'" -f2 | cut -d'/' -f2` | |
git config user.name "$merge_user" | |
git config user.email "$merge_email" | |
git tag -a "${{ steps.package_version.outputs.version }}" $merge_commit -m "${{ steps.package_version.outputs.package }} ${{ steps.package_version.outputs.version }} released" | |
git push origin ${{ steps.package_version.outputs.version }} | |
git fetch --tags | |
git checkout ${{ steps.package_version.outputs.version }} | |
- name: Build Release Version | |
id: build_release | |
if: steps.git_tag.outputs.exists == 0 | |
run: | | |
perl Makefile.PL | |
make manifest | |
make distcheck | |
make dist 2>make-dist_error.log > make-dist.log ; echo "Exit Code: '$?'" >> make-dist.log | |
echo "Build Release Report:" | |
cat make-dist.log | |
echo "Build Release Error:" | |
cat make-dist_error.log | |
dist_file=`cat make-dist.log | grep -i "created" | cut -d" " -f2` | |
echo "file=$dist_file" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: release | |
if: steps.git_tag.outputs.exists == 0 | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.package_version.outputs.version }} | |
token: ${{ secrets.PROJECT_RELEASE_TOKEN }} | |
files: ${{ steps.build_release.outputs.file }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJECT_RELEASE_TOKEN }} | |
# if [ $duplicated -ne 1 ]; then exit $publish_res ; fi; | |
- name: CPAN Publish | |
id: publish | |
if: steps.git_tag.outputs.exists == 0 | |
run: | | |
echo "${{ secrets.PAUSE_LOGIN }}" > ~/.pause | |
cpan-upload ${{ steps.build_release.outputs.file }} 2>cpan-upload_error.log > cpan-upload.log || echo "Exit Code: '$?'" >> cpan-upload.log | |
publish_res=`cat cpan-upload.log | grep -i "exit code:" | cut -d"'" -f2` | |
if [ -z "$publish_res" ]; then publish_res=0; echo "Exit Code: '0'" >> cpan-upload.log; fi; | |
duplicated=`cat cpan-upload_error.log | grep -i "Conflict" | wc -l` | |
echo "CPAN Upload Report:" | |
cat cpan-upload.log | |
echo "CPAN Upload Error:" | |
cat cpan-upload_error.log | |