Skip to content

Commit 47054f8

Browse files
committed
Build application in release creator workflow
Since stable is a protected branch, we can't commit there, which we need to do in order to publish to Packagist, see #37 It also removes the checksum code to keep things simple, and because we currently just print it as we recently removed it from the body to keep things simple.
1 parent 9b191fc commit 47054f8

File tree

2 files changed

+38
-68
lines changed

2 files changed

+38
-68
lines changed

.github/workflows/create-release.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,46 @@ jobs:
3636
git fetch origin master:master
3737
git reset --hard master
3838
39+
- name: Cache Composer packages
40+
id: composer-cache
41+
uses: actions/cache@v3
42+
with:
43+
path: vendor
44+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
45+
restore-keys: |
46+
${{ runner.os }}-php-
47+
48+
- name: Install dependencies
49+
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
50+
3951
- name: Bump application version
40-
id: bump-version
52+
id: build-version
4153
run: |
4254
php ./bin/bump-application-version.php ${{ github.event.inputs.type }}
4355
echo "version=$(php ./bin/get-release-version.php)" >> $GITHUB_OUTPUT
4456
echo "Version: v$(php ./bin/get-release-version.php)"
4557
58+
- name: Build executable
59+
run: php hyde standalone:build --build-version-suffix="${{ steps.build-version.outputs.sha_short }}"
60+
61+
- name: Verify executable
62+
run: php builds/hyde
63+
64+
- name: Verify executable version
65+
run: php builds/hyde --version
66+
67+
- name: Upload executable artifact
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: hyde
71+
path: builds/hyde
72+
4673
- name: Create pull request
4774
uses: peter-evans/create-pull-request@v5
4875
with:
49-
commit-message: "HydeCLI v${{ steps.bump-version.outputs.version }}"
50-
title: "HydeCLI v${{ steps.bump-version.outputs.version }}"
51-
branch: "release/v${{ steps.bump-version.outputs.version }}"
76+
commit-message: "HydeCLI v${{ steps.build-version.outputs.version }}"
77+
title: "HydeCLI v${{ steps.build-version.outputs.version }}"
78+
branch: "release/v${{ steps.build-version.outputs.version }}"
5279
delete-branch: true
5380

5481
body: |

.github/workflows/publish-release.yml

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -29,74 +29,19 @@ jobs:
2929
git merge stable
3030
git push origin master
3131
32-
build:
33-
runs-on: ubuntu-latest
34-
name: Build standalone executable
35-
36-
steps:
37-
- uses: actions/checkout@v3
38-
39-
- name: Cache Composer packages
40-
id: composer-cache
41-
uses: actions/cache@v3
42-
with:
43-
path: vendor
44-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
45-
restore-keys: |
46-
${{ runner.os }}-php-
47-
48-
- name: Install dependencies
49-
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
50-
51-
- name: Get build version
52-
id: build-version
53-
run: |
54-
echo "version=$(php ./bin/get-release-version.php)" >> $GITHUB_OUTPUT
55-
echo "Version: v$(php ./bin/get-release-version.php)"
56-
php ./bin/get-release-version.php > version
57-
58-
- name: Build executable
59-
run: php hyde standalone:build --build-version-suffix="${{ steps.build-version.outputs.sha_short }}"
60-
61-
- name: Verify executable
62-
run: php builds/hyde
63-
64-
- name: Verify executable version
65-
run: php builds/hyde --version
66-
67-
- name: Calculate checksum
68-
run: |
69-
cd builds
70-
sha256sum hyde > checksum.txt
71-
echo "SHA256 checksum of the application binary: $(cat checksum.txt)"
72-
73-
- name: Upload executable
74-
uses: actions/upload-artifact@v3
75-
with:
76-
name: hyde
77-
path: builds/hyde
78-
79-
- name: Upload the checksum artifact
80-
uses: actions/upload-artifact@v3
81-
with:
82-
name: checksum
83-
path: builds/checksum.txt
84-
85-
- name: Upload the version number artifact
86-
uses: actions/upload-artifact@v3
87-
with:
88-
name: version
89-
path: version
90-
9132
release:
92-
needs: build
9333
runs-on: ubuntu-latest
9434
name: Publish release
9535

9636
permissions:
9737
contents: write
9838

9939
steps:
40+
- uses: actions/checkout@v3
41+
with:
42+
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
43+
ref: stable
44+
10045
- name: Download the application artifact
10146
uses: actions/download-artifact@v3
10247
with:
@@ -116,13 +61,11 @@ jobs:
11661

11762
- name: Prepare version information
11863
run: |
119-
echo "CHECKSUM=$(cat builds/checksum.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV
120-
echo "VERSION=$(cat version)" >> $GITHUB_ENV
64+
echo "VERSION=$(php ./bin/get-release-version.php)" >> $GITHUB_ENV
12165
12266
- name: Print version information
12367
run: |
12468
echo "Version: v${{ env.VERSION }}"
125-
echo "Checksum: ${{ env.CHECKSUM }}"
12669
12770
- name: Create a release
12871
uses: ncipollo/release-action@v1
@@ -132,4 +75,4 @@ jobs:
13275
commit: ${{ github.sha }}
13376
updateOnlyUnreleased: true
13477
generateReleaseNotes: true
135-
artifacts: builds/hyde, builds/checksum.txt
78+
artifacts: builds/hyde

0 commit comments

Comments
 (0)