name: Push on GitHub (REUSABLE) on: workflow_call: inputs: VERSION: required: true type: string PRERELEASE: required: true type: boolean jobs: build: runs-on: ubuntu-latest steps: # Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # Generate checksum for install script - name: Generate checksum for install script run: | cd misc sha256sum install-bunkerweb.sh > install-bunkerweb.sh.sha256 # Get PDF doc - name: Get documentation if: inputs.VERSION != 'testing' uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: BunkerWeb_documentation_v${{ inputs.VERSION }}.pdf # Sanitize version (replace ~ with - for valid Git tag names) - name: Sanitize version id: sanitize run: | VERSION="${{ inputs.VERSION }}" echo "version=${VERSION//\~/-}" >> "$GITHUB_OUTPUT" # Create tag - uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # v1.7.2 name: Create tag if: inputs.VERSION != 'testing' with: tag: "v${{ steps.sanitize.outputs.version }}" message: "v${{ steps.sanitize.outputs.version }}" force_push_tag: true # Create tag - uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # v1.7.2 name: Create tag if: inputs.VERSION == 'testing' with: tag: "${{ steps.sanitize.outputs.version }}" message: "${{ steps.sanitize.outputs.version }}" force_push_tag: true # Extract and preserve changelog formatting - name: Extract changelog if: inputs.VERSION != 'testing' run: | # Extract the changelog content VERSION="${{ inputs.VERSION }}" # Check if this is a stable release (no -rc/-beta or ~rc/~beta suffix) if [[ ! "$VERSION" =~ [-~](rc|beta) ]]; then # For stable releases, extract the stable section and all related RC/beta sections # Extract major.minor.patch version (e.g., 1.6.5 from 1.6.5) BASE_VERSION=$(echo "$VERSION" | grep -oP '^\d+\.\d+\.\d+') # Find the line number of the current version header start_line=$(grep -n "^## v${BASE_VERSION}" CHANGELOG.md | head -1 | cut -d: -f1) # Find the line number of the next different version (not rc/beta of current version) end_line=$(awk -v start="$start_line" -v base="$BASE_VERSION" ' NR > start && /^## v/ { # Extract version from header ver = $0 sub(/^## v/, "", ver) sub(/ .*$/, "", ver) sub(/[-~].*$/, "", ver) if (ver != base) { print NR exit } } ' CHANGELOG.md) # If no next version found, extract to end of file if [ -z "$end_line" ]; then content=$(awk -v start="$start_line" 'NR >= start' CHANGELOG.md | grep -v '# Changelog' | grep -v '##' | sed '/^$/d') else content=$(awk -v start="$start_line" -v end="$end_line" 'NR >= start && NR < end' CHANGELOG.md | grep -v '# Changelog' | grep -v '##' | sed '/^$/d') fi else # For RC/beta releases, extract only the specific section # Find the line number of the specific version header start_line=$(grep -n "^## v${VERSION}" CHANGELOG.md | head -1 | cut -d: -f1) # Find the line number of the next version header end_line=$(awk -v start="$start_line" 'NR > start && /^## v/ {print NR; exit}' CHANGELOG.md) # If no next version found, extract to end of file if [ -z "$end_line" ]; then content=$(awk -v start="$start_line" 'NR >= start' CHANGELOG.md | grep -v '# Changelog' | grep -v '##' | sed '/^$/d') else content=$(awk -v start="$start_line" -v end="$end_line" 'NR >= start && NR < end' CHANGELOG.md | grep -v '# Changelog' | grep -v '##' | sed '/^$/d') fi fi echo "DECODED_CHANGELOG<> $GITHUB_ENV echo "$content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV # Create release - name: Create release if: inputs.VERSION != 'testing' uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 with: body: | Documentation : https://docs.bunkerweb.io/${{ inputs.VERSION }}/ Docker tags : - All-in-one : `bunkerity/bunkerweb-all-in-one:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-all-in-one:${{ steps.sanitize.outputs.version }}` - BunkerWeb : `bunkerity/bunkerweb:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb:${{ steps.sanitize.outputs.version }}` - Scheduler : `bunkerity/bunkerweb-scheduler:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-scheduler:${{ steps.sanitize.outputs.version }}` - Autoconf : `bunkerity/bunkerweb-autoconf:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-autoconf:${{ steps.sanitize.outputs.version }}` - UI : `bunkerity/bunkerweb-ui:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-ui:${{ steps.sanitize.outputs.version }}` - API : `bunkerity/bunkerweb-api:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-api:${{ steps.sanitize.outputs.version }}` Linux packages : https://packagecloud.io/app/bunkerity/bunkerweb/search?q=${{ inputs.VERSION }}&filter=all&dist= Changelog : ${{ env.DECODED_CHANGELOG }} draft: true prerelease: ${{ inputs.PRERELEASE }} name: v${{ steps.sanitize.outputs.version }} tag_name: v${{ steps.sanitize.outputs.version }} discussion_category_name: Announcements files: | BunkerWeb_documentation_v${{ inputs.VERSION }}.pdf misc/install-bunkerweb.sh misc/install-bunkerweb.sh.sha256 # Create release - name: Create release if: inputs.VERSION == 'testing' uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 with: body: | **The testing version of BunkerWeb should not be used in production, please use the latest stable version instead.** Documentation : https://docs.bunkerweb.io/${{ inputs.VERSION }}/ Docker tags : - BunkerWeb : `bunkerity/bunkerweb:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb:${{ steps.sanitize.outputs.version }}` - Scheduler : `bunkerity/bunkerweb-scheduler:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-scheduler:${{ steps.sanitize.outputs.version }}` - Autoconf : `bunkerity/bunkerweb-autoconf:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-autoconf:${{ steps.sanitize.outputs.version }}` - UI : `bunkerity/bunkerweb-ui:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-ui:${{ steps.sanitize.outputs.version }}` - API : `bunkerity/bunkerweb-api:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-api:${{ steps.sanitize.outputs.version }}` - All-in-one : `bunkerity/bunkerweb-all-in-one:${{ steps.sanitize.outputs.version }}` or `ghcr.io/bunkerity/bunkerweb-all-in-one:${{ steps.sanitize.outputs.version }}` Linux packages : https://packagecloud.io/app/bunkerity/bunkerweb/search?q=${{ inputs.VERSION }}&filter=all&dist= Please note that when using Linux Debian or Ubuntu integration, you will need to add the `force-bad-version` directive to your `/etc/dpkg/dpkg.cfg` file before installing the testing version of BunkerWeb. draft: false prerelease: ${{ inputs.PRERELEASE }} name: Testing tag_name: ${{ steps.sanitize.outputs.version }} files: | misc/install-bunkerweb.sh misc/install-bunkerweb.sh.sha256