Skip to content

Commit

Permalink
Merge branch '10.x' into 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed May 24, 2024
2 parents f36e042 + 69b2440 commit e7d3a54
Showing 1 changed file with 73 additions and 54 deletions.
127 changes: 73 additions & 54 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ jobs:
- name: Remove optional "v" prefix
id: version
run: |
VERSION=${{ inputs.version }}
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
env:
VERSION: ${{ inputs.version }}

- name: Check if branch and version match
id: guard
run: |
MAJOR_VERSION="${NUMERIC_VERSION%%.*}"
BRANCH_MAJOR_VERSION="${BRANCH%%.*}"
echo "MAJOR_VERSION=$(echo $MAJOR_VERSION)" >> $GITHUB_OUTPUT;
echo "BRANCH_MAJOR_VERSION=$(echo $BRANCH_MAJOR_VERSION)" >> $GITHUB_OUTPUT;
if [ "$MAJOR_VERSION" != "$BRANCH_MAJOR_VERSION" ]; then
echo "Mismatched versions! Aborting."
VERSION_MISMATCH='true';
Expand All @@ -47,7 +45,7 @@ jobs:
VERSION_MISMATCH='false';
fi
echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> $GITHUB_OUTPUT;
echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> "$GITHUB_OUTPUT";
env:
BRANCH: ${{ github.ref_name }}
NUMERIC_VERSION: ${{ steps.version.outputs.version }}
Expand All @@ -67,53 +65,74 @@ jobs:
with:
commit_message: "Update version to v${{ steps.version.outputs.version }}"

- name: SSH into splitter server
uses: appleboy/ssh-action@master
# - name: SSH into splitter server
# uses: appleboy/ssh-action@master
# with:
# host: 104.248.56.26
# username: forge
# key: ${{ secrets.SSH_PRIVATE_KEY_SPLITTER }}
# script: |
# cd laravel-${{ github.ref_name }}
# git pull origin ${{ github.ref_name }}
# bash ./bin/release.sh v${{ steps.version.outputs.version }}
# script_stop: true

- name: Generate release notes
id: generated-notes
uses: RedCrafter07/release-notes-action@main
with:
host: 104.248.56.26
username: forge
key: ${{ secrets.SSH_PRIVATE_KEY_SPLITTER }}
script: |
cd laravel-${{ github.ref_name }}
git pull origin ${{ github.ref_name }}
bash ./bin/release.sh v${{ steps.version.outputs.version }}
script_stop: true

# - name: Generate release notes
# id: generated-notes
# uses: RedCrafter07/release-notes-action@main
# with:
# tag-name: v${{ steps.version.outputs.version }}
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref_name }}

# - name: Cleanup release notes
# id: cleaned-notes
# run: |
# RELEASE_NOTES=$(echo $RELEASE_NOTES | sed '/## What/d')
# RELEASE_NOTES=$(echo $RELEASE_NOTES | sed '/## New Contributors/,$d')
# echo "notes=${RELEASE_NOTES}" >> "$GITHUB_OUTPUT"
# env:
# RELEASE_NOTES: ${{ steps.generated-notes.outputs.release-notes }}

# - name: Create release
# uses: softprops/action-gh-release@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: v${{ steps.version.outputs.version }}
# name: v${{ steps.version.outputs.version }}
# body: ${{ steps.cleaned-notes.outputs.notes }}
# target_commitish: ${{ github.ref_name }}
# make_latest: 'legacy'

# update-changelog:
# needs: release

# name: Update changelog

# uses: laravel/.github/.github/workflows/update-changelog.yml@main
# with:
# branch: ${{ github.ref_name }}
# version: "v${{ needs.release.outputs.version }}"
# notes: ${{ needs.release.outputs.notes }}
tag-name: v${{ steps.version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}

- name: Cleanup release notes
id: cleaned-notes
run: |
START_FROM=$(echo -n "$RELEASE_NOTES" | awk "/What's Changed/{ print NR; exit }" -)
DROP_FROM_CONTRIBUTORS=$(echo -n "$RELEASE_NOTES" | awk "/New Contributors/{ print NR; exit }" -)
DROP_FROM_FULL_CHANGELOG=$(echo -n "$RELEASE_NOTES" | awk "/Full Changelog/{ print NR; exit }" -)
# Drop everything starting from "Full Changelog"
if [ ! -z "$DROP_FROM_FULL_CHANGELOG" ]; then
RELEASE_NOTES=$(echo -n "$RELEASE_NOTES" | sed "${DROP_FROM_FULL_CHANGELOG},$ d")
fi
# Drop everything starting from "New Contributors"
if [ ! -z "$DROP_FROM_CONTRIBUTORS" ]; then
RELEASE_NOTES=$(echo -n "$RELEASE_NOTES" | sed "${DROP_FROM_CONTRIBUTORS},$ d")
fi
# Drop the line "What's Changed"
if [ ! -z "$START_FROM" ]; then
RELEASE_NOTES=$(echo -n "$RELEASE_NOTES" | sed "${START_FROM}d")
fi
{
echo 'notes<<EOF'
echo "$RELEASE_NOTES"
echo EOF
} >> "$GITHUB_OUTPUT";
env:
RELEASE_NOTES: ${{ steps.generated-notes.outputs.release-notes }}

- name: Create release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
body: ${{ steps.cleaned-notes.outputs.notes }}
target_commitish: ${{ github.ref_name }}
make_latest: "${{ github.ref_name == github.event.repository.default_branch }}"

update-changelog:
needs: release

name: Update changelog

uses: laravel/.github/.github/workflows/update-changelog.yml@main
with:
branch: ${{ github.ref_name }}
version: "v${{ needs.release.outputs.version }}"
notes: ${{ needs.release.outputs.notes }}

0 comments on commit e7d3a54

Please sign in to comment.