📦 Release #23
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: "📦 Release" | |
run-name: "📦 Release" | |
on: | |
workflow_dispatch: | |
inputs: | |
# --------------------------------------------------------------------------------------- | |
# Name of the plugin to use when creating the release zip filename | |
# e.g: csf-firewall-v1.0.0.zip | |
# --------------------------------------------------------------------------------------- | |
PLUGIN_NAME: | |
description: "📦 Name of Plugin" | |
required: true | |
default: 'csf-firewall' | |
type: string | |
# --------------------------------------------------------------------------------------- | |
# Version to release | |
# e.g: v1.0.0 | |
# --------------------------------------------------------------------------------------- | |
PLUGIN_VERSION: | |
description: "📦 Version" | |
required: true | |
default: '1.x.x' | |
type: string | |
# --------------------------------------------------------------------------------------- | |
# ENABLE: the changelog generated in releases tab will only display single commits. | |
# DISABLE: the changelog shows pull requests completed based on their labels | |
# --------------------------------------------------------------------------------------- | |
CHANGELOG_MODE_COMMIT: | |
description: "📑 Use Commits Instead of PRs" | |
required: true | |
default: true | |
type: boolean | |
# --------------------------------------------------------------------------------------- | |
# ENABLE: Will show all types of commits, including uncategorized | |
# DISABLE: WIll only show actions that have been categorized using the format | |
# type(scope): description | |
# type: description | |
# --------------------------------------------------------------------------------------- | |
SHOW_UNCATEGORIZED: | |
description: "🗂️ Show Uncategorized Commits" | |
required: true | |
default: false | |
type: boolean | |
# --------------------------------------------------------------------------------------- | |
# ENABLE: released version will be marked as pre-release | |
# DISABLE: release version will be marked as stable / normal release | |
# --------------------------------------------------------------------------------------- | |
PRERELEASE: | |
description: "🧪 Build RC (Pre-release)" | |
required: true | |
default: false | |
type: boolean | |
# --------------------------------------------------------------------------------------- | |
# Release Candidate version number | |
# this will be added to the end of your released app in the releases page. | |
# e.g: csf-firewall-v1.0.0-rc.1 | |
# --------------------------------------------------------------------------------------- | |
VERSION_RC: | |
description: "🧪 RC (Pre-release) Ver (csf-firewall-rc.v1)" | |
required: false | |
type: string | |
default: "1" | |
# --------------------------------------------------------------------------------------- | |
# environment variables | |
# --------------------------------------------------------------------------------------- | |
env: | |
PLUGIN_NAME: csf-firewall | |
ASSIGN_USER: Aetherinox | |
BOT_NAME_1: AdminServ | |
BOT_NAME_2: AdminServX | |
BOT_NAME_3: EuropaServ | |
BOT_NAME_DEPENDABOT: dependabot[bot] | |
# --------------------------------------------------------------------------------------- | |
# jobs | |
# --------------------------------------------------------------------------------------- | |
jobs: | |
# --------------------------------------------------------------------------------------- | |
# JOB > INITIALIZE | |
# --------------------------------------------------------------------------------------- | |
job-upload: | |
name: >- | |
📦 Package › Upload | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
outputs: | |
version_csf: ${{ steps.task_build_download_csf.outputs.VERSION_CSF }} | |
version_build: ${{ steps.task_build_download_csf.outputs.VERSION_BUILD }} | |
version_tag_previous: ${{ steps.task_build_getver.outputs.VERSION_TAG_PREV }} | |
steps: | |
# --------------------------------------------------------------------------------------- | |
# Job > Start | |
# --------------------------------------------------------------------------------------- | |
- name: "✅ Start" | |
id: task_build_start | |
run: | | |
echo "Starting build" | |
# --------------------------------------------------------------------------------------- | |
# Job > Checkout | |
# --------------------------------------------------------------------------------------- | |
- name: "☑️ Checkout" | |
id: task_build_checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# --------------------------------------------------------------------------------------- | |
# Job > Get Previous Tag | |
# | |
# this is for no particular reason except to just report the last version released | |
# --------------------------------------------------------------------------------------- | |
- name: "🏷️ Get Previous tag" | |
id: task_tag_previous | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: 1.0.0 | |
# --------------------------------------------------------------------------------------- | |
# Job > Print Current Version | |
# | |
# this is for no particular reason except to just report the last version released | |
# --------------------------------------------------------------------------------------- | |
- name: "🔨 Debug: Previous Github Tag" | |
id: task_build_getver | |
run: | | |
echo -e ${{ steps.task_tag_previous.outputs.tag }} | |
echo "VERSION_TAG_PREV=${{ steps.task_tag_previous.outputs.tag }}" >> $GITHUB_OUTPUT | |
# --------------------------------------------------------------------------------------- | |
# Job > Download latest version of ConfigServer Firewall | |
# | |
# download csf .tgz from official website | |
# read /csf/version.txt inside the .tgz and grab version, assign to env var | |
# rename original .tgz to new name which includes version number: | |
# - csf-firewall.tgz => csf-firewall-v14.20.tgz | |
# --------------------------------------------------------------------------------------- | |
- name: "⬇️ Download: ConfigServer Firewall" | |
id: task_build_download_csf | |
run: | | |
mkdir release | |
wget https://download.configserver.com/csf.tgz -O release/${{ inputs.PLUGIN_NAME }}.tgz | |
# # | |
# generate build number | |
# 2408.07 (YYMM.DD) | |
# # | |
ver_build=$(date -u '+%y%m-%d') | |
echo "VERSION_BUILD=$ver_build" >> $GITHUB_OUTPUT | |
# # | |
# get csf version from version.txt in .tgz | |
# # | |
ver_csf=$(tar -axf release/${{ inputs.PLUGIN_NAME }}.tgz csf/version.txt -O) | |
echo "VERSION_CSF=$ver_csf" >> $GITHUB_OUTPUT | |
echo -e "Found ConfigServer Firewall v${ver_csf}" | |
# # | |
# rename .tgz | |
# # | |
mv release/${{ inputs.PLUGIN_NAME }}.tgz release/${{ inputs.PLUGIN_NAME }}-v${ver_csf}.tgz | |
echo -e "Creating release/${{ inputs.PLUGIN_NAME }}-v${ver_csf}.tgz" | |
# --------------------------------------------------------------------------------------- | |
# Upload artifacts > release/csf-firewall-v14.20.tgz | |
# --------------------------------------------------------------------------------------- | |
- name: >- | |
📋 Upload Artifacts › ${{ inputs.PLUGIN_NAME }}.tgz | |
id: task_build_artifact_csf | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ${{ inputs.PLUGIN_NAME }}-v${{ steps.task_build_download_csf.outputs.VERSION_CSF }}.tgz | |
path: release/${{ inputs.PLUGIN_NAME }}-v${{ steps.task_build_download_csf.outputs.VERSION_CSF }}.tgz | |
retention-days: 30 | |
# --------------------------------------------------------------------------------------- | |
# Job > Release | |
# --------------------------------------------------------------------------------------- | |
job-release: | |
name: >- | |
📦 Package › Release | |
runs-on: ubuntu-latest | |
needs: [ job-upload ] | |
permissions: | |
contents: write | |
packages: write | |
env: | |
VERSION_CSF: ${{ needs.job-upload.outputs.version_csf }} | |
VERSION_BUILD: ${{ needs.job-upload.outputs.version_build }} | |
VERSION_TAG_PREV: ${{ needs.job-upload.outputs.version_tag_previous }} | |
steps: | |
# --------------------------------------------------------------------------------------- | |
# Dist Releases > Checkout | |
# --------------------------------------------------------------------------------------- | |
- name: "☑️ Checkout" | |
uses: actions/checkout@v4 | |
id: task_release_checkout | |
with: | |
fetch-depth: 0 | |
# --------------------------------------------------------------------------------------- | |
# Debug : View passed values | |
# --------------------------------------------------------------------------------------- | |
- name: "⚙️ Debug › Passed Values" | |
id: task_release_debug_print_vals_1 | |
run: | | |
echo "TAG VERSION (Previous) ........... ${{ env.VERSION_TAG_PREV }}" | |
echo "TAG VERSION (Next) ............... ${{ inputs.PLUGIN_VERSION }}" | |
echo "CSF VERSION ...................... ${{ env.VERSION_CSF }}" | |
echo "RELEASE BUILD .................... ${{ env.VERSION_BUILD }}" | |
# --------------------------------------------------------------------------------------- | |
# Build Project & Create Zip | |
# --------------------------------------------------------------------------------------- | |
- name: "🔨 Build › Stable ( ${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-patches.zip )" | |
id: task_release_build_st | |
if: ${{ startsWith( inputs.PRERELEASE, false ) }} | |
run: | | |
echo Building STABLE Package .zip ${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-patches.zip | |
mv patch/* . | |
zip -r ${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-patches.zip README.md LICENSE *.sh | |
ls | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }} | |
- name: "🔨 Build › Release Candidate ( ${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-rc.${{ inputs.VERSION_RC }}-patches.zip )" | |
id: task_release_build_rc | |
if: ${{ startsWith( inputs.PRERELEASE, true ) }} | |
run: | | |
echo Building PRE-RELEASE Package .zip ${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-rc.${{ inputs.VERSION_RC }}-patches.zip | |
zip -r ${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-rc.${{ inputs.VERSION_RC }}-patches.zip README.md LICENSE *.sh | |
ls | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }} | |
# --------------------------------------------------------------------------------------- | |
# [ Tag ]: Pre Create | |
# | |
# in order to use the changelog github action, you must pre-create the tag otherwise | |
# the changelog action will have no idea what tag you are going to be creating and | |
# the list of commits will not be for the correct release. | |
# --------------------------------------------------------------------------------------- | |
- name: "🔖 Tag › Pre Create ${{ inputs.PLUGIN_VERSION }}" | |
uses: rickstaa/action-create-tag@v1 | |
id: task_release_tag | |
with: | |
tag: ${{ inputs.PLUGIN_VERSION }} | |
tag_exists_error: false | |
message: "Latest release" | |
gpg_private_key: ${{ secrets.ADMINSERV_GPG_KEY_ASC }} | |
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }} | |
# --------------------------------------------------------------------------------------- | |
# [ Tag ]: Confirm | |
# --------------------------------------------------------------------------------------- | |
- name: "🔖 Tag › Confirm ${{ inputs.PLUGIN_VERSION }}" | |
run: | | |
echo "Tag already present: ${{ env.TAG_EXISTS }}" | |
echo "Tag already present: ${{ steps.task_release_tag.outputs.tag_exists }}" | |
# --------------------------------------------------------------------------------------- | |
# Contributor Images | |
# --------------------------------------------------------------------------------------- | |
- name: "🥸 Contributors › Generate" | |
id: task_release_contribs_generate | |
uses: jaywcjlove/github-action-contributors@main | |
with: | |
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) | |
output: CONTRIBUTORS.svg | |
avatarSize: 42 | |
# --------------------------------------------------------------------------------------- | |
# Generate Changelog | |
# | |
# generates a changelog from the github api. requires a PREVIOUS_TAG in order to figure | |
# out the changes made between the two versions. | |
# | |
# outputs: | |
# ${{ steps.changelog.outputs.changelog }} | |
# --------------------------------------------------------------------------------------- | |
- name: "📝 Changelog › Pre Setup (Categorized Commits)" | |
id: task_release_changelog_commits_tags_print | |
run: | | |
echo "TAG_LAST=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
echo "COMMIT_LAST=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: "📝 Changelog › Build (Categorized)" | |
id: task_release_changelog_categorized | |
if: | | |
startsWith( inputs.SHOW_UNCATEGORIZED, false ) || | |
startsWith( env.SHOW_UNCATEGORIZED, false ) | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
token: ${{ secrets.ADMINSERV_TOKEN }} | |
configuration: ".github/changelog-configuration.json" | |
ignorePreReleases: false | |
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT || env.CHANGELOG_MODE_COMMIT }} | |
fetchReleaseInformation: true | |
fetchViaCommits: true | |
configurationJson: | | |
{ | |
"template": "## Release Info \n| Item | Value |\n| --- | --- |\n|<sub>Stamp</sub>|<sub>`#{{FROM_TAG}}-#{{FROM_TAG_DATE}} 🔺 #{{TO_TAG}}-#{{TO_TAG_DATE}}`</sub>|\n|<sub>Last Release</sub>|<sub>`#{{DAYS_SINCE}} days ago`</sub>|\n\n<br>\n\n---\n\n<br>\n\n### What's New\nThis release contains the following changes:\n\n<br>\n\n---\n\n<br>\n\n### Statistics\nHow the files have changed:\n<ul><li><a href='#{{RELEASE_DIFF}}'>Changed files</a> : <b>#{{CHANGED_FILES}}</b> </li><li>Changes : <b>#{{CHANGES}}</b> </li><li>Commits : <b>#{{COMMITS}}</b> </li><li>Additions : <b>#{{ADDITIONS}}</b></li><li>Deletions : <b>#{{DELETIONS}}</b></li><li>PRs (categorized) : <b>#{{CATEGORIZED_COUNT}}</b></li><li>PRs (uncategorized) : <b>#{{UNCATEGORIZED_COUNT}}</b></li><li>PRs (open) : <b>#{{OPEN_COUNT}}</b></li>\n<br />\n</ul>\n\n<br>\n\n---\n\n<br>\n\n### Pull Requests\nThis release is associated with the following pull requests:\n#{{CHANGELOG}}\n\n<br>\n\n---\n\n<br>\n\n" | |
} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }} | |
# --------------------------------------------------------------------------------------- | |
# shows only categorized commits using the commit standards | |
# type(scope): description | |
# type: description | |
# --------------------------------------------------------------------------------------- | |
- name: "📝 Changelog › Build (Uncategorized)" | |
id: task_release_changelog_uncategorized | |
if: | | |
startsWith( inputs.SHOW_UNCATEGORIZED, true ) || | |
startsWith( env.SHOW_UNCATEGORIZED, true ) | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
token: ${{ secrets.ADMINSERV_TOKEN }} | |
configuration: ".github/changelog-configuration.json" | |
ignorePreReleases: false | |
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT || env.CHANGELOG_MODE_COMMIT }} | |
fetchReleaseInformation: true | |
fetchViaCommits: true | |
configurationJson: | | |
{ | |
"template": "## Release Info \n| Item | Value |\n| --- | --- |\n|<sub>Stamp</sub>|<sub>`#{{FROM_TAG}}-#{{FROM_TAG_DATE}} 🔺 #{{TO_TAG}}-#{{TO_TAG_DATE}}`</sub>|\n|<sub>Last Release</sub>|<sub>`#{{DAYS_SINCE}} days ago`</sub>|\n\n<br>\n\n---\n\n<br>\n\n### What's New\nThis release contains the following changes:\n\n<br>\n\n---\n\n<br>\n\n### Statistics\nHow the files have changed:\n<ul><li><a href='#{{RELEASE_DIFF}}'>Changed files</a> : <b>#{{CHANGED_FILES}}</b> </li><li>Changes : <b>#{{CHANGES}}</b> </li><li>Commits : <b>#{{COMMITS}}</b> </li><li>Additions : <b>#{{ADDITIONS}}</b></li><li>Deletions : <b>#{{DELETIONS}}</b></li><li>PRs (categorized) : <b>#{{CATEGORIZED_COUNT}}</b></li><li>PRs (uncategorized) : <b>#{{UNCATEGORIZED_COUNT}}</b></li><li>PRs (open) : <b>#{{OPEN_COUNT}}</b></li>\n<br />\n</ul>\n\n<br>\n\n---\n\n<br>\n\n### Pull Requests\nThis release is associated with the following pull requests:\n#{{CHANGELOG}}\n\n<br>\n\n" | |
} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }} | |
# --------------------------------------------------------------------------------------- | |
# Fetch Changelog | |
# --------------------------------------------------------------------------------------- | |
- name: "📝 Changelog › Print (Categorized)" | |
id: task_release_changelog_print_categorized | |
if: | | |
startsWith( inputs.SHOW_UNCATEGORIZED, false ) || | |
startsWith( env.SHOW_UNCATEGORIZED, false ) | |
run: | | |
echo "${{ steps.task_release_changelog_categorized.outputs.changelog }}" | |
- name: "📝 Changelog › Print (Uncategorized)" | |
id: task_release_changelog_print_uncategorized | |
if: | | |
startsWith( inputs.SHOW_UNCATEGORIZED, true ) || | |
startsWith( env.SHOW_UNCATEGORIZED, true ) | |
run: | | |
echo "${{ steps.task_release_changelog_uncategorized.outputs.changelog }}" | |
# --------------------------------------------------------------------------------------- | |
# artifacts > download | |
# --------------------------------------------------------------------------------------- | |
- name: "⚙️ Debug › Clean Dist Folder" | |
run: | | |
tree | |
- name: "📁 Download › Saved Artifacts" | |
uses: actions/download-artifact@v4 | |
# --------------------------------------------------------------------------------------- | |
# Clean dist folder since we're getting the files from artifacts | |
# --------------------------------------------------------------------------------------- | |
- name: "⚙️ Debug › Clean Dist Folder" | |
run: | | |
tree | |
# --------------------------------------------------------------------------------------- | |
# [ Release ]: Post Release | |
# | |
# outputs: | |
# [RELEASE ID]: | |
# ${{ steps.task_release_bundle_rc.outputs.id | |
# ${{ steps.task_release_bundle_st.outputs.id | |
# --------------------------------------------------------------------------------------- | |
- name: "🏳️ Post › Stable" | |
id: task_release_bundle_st | |
if: | | |
startsWith( inputs.PRERELEASE, false ) || | |
startsWith( env.PRERELEASE, false ) | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }} | |
with: | |
token: ${{ secrets.ADMINSERV_TOKEN_CL }} | |
name: v${{ inputs.PLUGIN_VERSION }} | |
tag_name: ${{ inputs.PLUGIN_VERSION }} | |
target_commitish: ${{ github.event.inputs.branch }} | |
draft: false | |
generate_release_notes: false | |
files: | | |
${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-patches.zip | |
${{ inputs.PLUGIN_NAME }}-v${{ env.VERSION_CSF }}.tgz/${{ inputs.PLUGIN_NAME }}-v${{ env.VERSION_CSF }}.tgz | |
prerelease: false | |
body: | | |
${{ steps.task_release_changelog_categorized.outputs.changelog }} | |
${{ steps.task_release_changelog_uncategorized.outputs.changelog }} | |
- name: "🏳️ Post › Release Candidate" | |
id: task_release_bundle_rc | |
if: | | |
startsWith( inputs.PRERELEASE, true ) || | |
startsWith( env.PRERELEASE, true ) | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }} | |
with: | |
token: ${{ secrets.ADMINSERV_TOKEN }} | |
name: v${{ inputs.PLUGIN_VERSION }} | |
tag_name: ${{ inputs.PLUGIN_VERSION }} | |
target_commitish: ${{ github.event.inputs.branch }} | |
draft: false | |
generate_release_notes: false | |
files: | | |
${{ inputs.PLUGIN_NAME }}-v${{ inputs.PLUGIN_VERSION }}-rc.${{ inputs.VERSION_RC }}-patches.zip | |
${{ inputs.PLUGIN_NAME }}-v${{ env.VERSION_CSF }}.tgz/${{ inputs.PLUGIN_NAME }}-v${{ env.VERSION_CSF }}.tgz | |
prerelease: false | |
body: | | |
> [!WARNING] | |
> This is a **release candidate**, which means it is not a stable release and could contain bugs. You should download it at your own risk. | |
${{ steps.task_release_changelog_categorized.outputs.changelog }} | |
${{ steps.task_release_changelog_uncategorized.outputs.changelog }} | |
# --------------------------------------------------------------------------------------- | |
# Print Status | |
# --------------------------------------------------------------------------------------- | |
- name: "🎛️ Status › Print" | |
id: task_release_status_print | |
run: | | |
echo "Printing Variables" | |
echo | |
echo "---- CHANGELOG ---------------------------------------------------------------" | |
echo "${{ steps.task_release_changelog_categorized.outputs.changelog }}" | |
echo "${{ steps.task_release_changelog_uncategorized.outputs.changelog }}" | |
echo "---- CHANGELOG ---------------------------------------------------------------" | |
echo "" | |
echo "" | |
echo "---- VARIABLES ---------------------------------------------------------------" | |
echo "Package Version ............ ${{ inputs.PLUGIN_VERSION }}" | |
echo "Tag: Previous .............. ${{ env.TAG_LAST }}" | |
echo "Tag: Now.... ............... ${{ github.ref }}" | |
echo "Last Commit ................ ${{ env.COMMIT_LAST }}" | |
echo "ST Output ID ............... ${{ steps.task_release_bundle_st.outputs.id }}" | |
echo "RC Output ID ............... ${{ steps.task_release_bundle_rc.outputs.id }}" | |
echo "---- CHANGELOG ---------------------------------------------------------------" |