Repository navigation
74 lines (61 loc) · 1.96 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (61 loc) · 1.96 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
68
69
70
71
72
73
74
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- name: Install runtime dependencies
run: composer install --no-dev --no-interaction --no-progress --prefer-dist
- name: Build phar
run: php -d phar.readonly=0 build
- name: Resolve version
id: version
run: |
VERSION="$(php dist/phploy.phar --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.]+)?')"
echo "phar reports v${VERSION}"
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
TAG="${GITHUB_REF_NAME#v}"
[ "$VERSION" = "$TAG" ] || { echo "::error::phar version ${VERSION} != tag ${TAG}"; exit 1; }
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Generate latest.json
run: |
SHA="$(sha256sum dist/phploy.phar | cut -d' ' -f1)"
printf '{"version":"%s","url":"https://banago.github.io/PHPloy/phploy.phar","sha256":"%s"}\n' \
"${{ steps.version.outputs.version }}" "$SHA" > dist/latest.json
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/phploy.phar
generate_release_notes: true
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4