Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build Docker Image

on:
push:
workflow_run:
workflows: [ "Publish a new release" ]
types: [ completed ]
branches: [ "stable" ]

env:
Expand All @@ -13,9 +15,10 @@ env:
jobs:

# The image needs the Linux executable, which is not committed to the repository. This
# workflow runs on pushes to `stable`, after publish-release.yml has published the
# artifacts, so it takes the executable from the release rather than rebuilding it.
# workflow runs after publish-release.yml has successfully published the artifacts, so
# it takes the executable from that exact release rather than rebuilding it.
build-docker-image:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

permissions:
Expand All @@ -24,14 +27,29 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
ref: ${{ github.event.workflow_run.head_sha }}

# Get the version from the exact commit published by the triggering workflow.
- name: Get current version
run: |
set -euo pipefail

version="$(php ./bin/get-release-version.php)"
echo "VERSION=$version" >> "$GITHUB_ENV"

- name: Download the published Linux executable
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail

mkdir -p builds
gh release download --repo "${{ github.repository }}" --pattern hyde-linux-x86_64 --dir builds
gh release download "v${VERSION}" \
--repo "${{ github.repository }}" \
--pattern "hyde-linux-x86_64" \
--dir builds
chmod +x builds/hyde-linux-x86_64

# Install the cosign tool
Expand All @@ -56,11 +74,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Get the current version
- name: Get current version
id: get-version
run: echo "VERSION=$(php ./bin/get-release-version.php)" >> $GITHUB_ENV

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
Expand Down
65 changes: 57 additions & 8 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,65 @@ jobs:
runs-on: ubuntu-latest
name: Merge stable branch into master

steps:
- uses: actions/checkout@v5
with:
ref: master
permissions:
contents: write
pull-requests: write

- name: Merge stable branch into master
env:
GH_TOKEN: ${{ github.token }}

steps:
- name: Create or reuse stable-to-master pull request
run: |
git fetch origin stable:stable
git merge stable
git push origin master
set -euo pipefail

find_sync_pr() {
gh pr list \
--repo "$GITHUB_REPOSITORY" \
--base master \
--head stable \
--state open \
--limit 1 \
--json number \
--jq '.[0].number // empty'
}

pr_number="$(find_sync_pr)"

if [[ -z "$pr_number" ]]; then
ahead_count="$(gh api \
"repos/$GITHUB_REPOSITORY/compare/master...stable" \
--jq '.ahead_by')"

if [[ ! "$ahead_count" =~ ^[0-9]+$ ]]; then
echo "Failed to compare the stable and master branches." >&2
exit 1
fi

if [[ "$ahead_count" == "0" ]]; then
echo "The stable branch is already fully synced to master."
exit 0
fi

if ! gh pr create \
--repo "$GITHUB_REPOSITORY" \
--base master \
--head stable \
--title "Merge stable branch into master" \
--body "Automatically sync the stable release branch back into master after publishing a release."; then
echo "Pull request creation failed; checking whether another run created it." >&2
fi

pr_number="$(find_sync_pr)"
fi

if [[ -z "$pr_number" ]]; then
echo "Failed to find the stable-to-master pull request." >&2
exit 1
fi

echo "Submitting pull request #$pr_number to the master merge queue."
gh pr merge "$pr_number" --repo "$GITHUB_REPOSITORY"

build:
uses: ./.github/workflows/build-native-all.yml
Expand Down
2 changes: 1 addition & 1 deletion app/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Application extends \Hyde\Foundation\Application
* framework version. The 0.11.x CLI line embeds and supports the unreleased HydePHP
* v3 development line, but the two versions must never be made to track each other.
*/
final public const APP_VERSION = '0.10.13';
final public const APP_VERSION = '0.11.0';

/**
* Get the path to the cached packages.php file.
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
});

test('the CLI is versioned independently of the framework', function () {
expect(Application::APP_VERSION)->toBe('0.10.13');
expect(Application::APP_VERSION)->toBe('0.11.0');
});

test('custom application extends Hyde application', function () {
Expand Down
Loading