-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (56 loc) · 1.91 KB
/
build.yml
File metadata and controls
67 lines (56 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Build and Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine next version
id: version
run: |
LATEST_TAG=$(git tag --sort=-v:refname | head -n 1)
if [ -z "$LATEST_TAG" ]; then
NEXT_VERSION="0.0.1"
else
MAJOR=$(echo "$LATEST_TAG" | cut -d. -f1)
MINOR=$(echo "$LATEST_TAG" | cut -d. -f2)
PATCH=$(echo "$LATEST_TAG" | cut -d. -f3)
NEXT_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
fi
echo "tag=${NEXT_VERSION}" >> "$GITHUB_OUTPUT"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, curl
tools: composer:v2
- name: Install dependencies
run: composer install --no-dev --prefer-dist --optimize-autoloader
- name: Download Box
run: |
curl -LSs https://box-project.github.io/box2/installer.php | php
mv box.phar /usr/local/bin/box
chmod +x /usr/local/bin/box
- name: Build phar
run: php hypernode-api-cli app:build hypernode-api-cli --build-version=${{ steps.version.outputs.tag }}
- name: Create tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.version.outputs.tag }}
git push origin ${{ steps.version.outputs.tag }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: v${{ steps.version.outputs.tag }}
files: builds/hypernode-api-cli
generate_release_notes: true