Skip to content

Commit 460d29f

Browse files
committed
add demo with github pages (refs #41)
1 parent bc62396 commit 460d29f

4 files changed

Lines changed: 101 additions & 0 deletions

File tree

.ci/build-demo.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
PROJECT_DIR=$(dirname "$SCRIPT_DIR")
5+
6+
if [ -z "$SATIS_GITHUB_TOKEN" ];
7+
then
8+
echo "SATIS_GITHUB_TOKEN required"
9+
exit
10+
fi
11+
12+
cd "$PROJECT_DIR"
13+
14+
# generate the satis config file (satis.json)
15+
bin/satis-gitlab gitlab-to-config \
16+
--template ".ci/template.json" \
17+
https://github.com $SATIS_GITHUB_TOKEN \
18+
--users=mborne \
19+
--ignore="(^mborne\\/php-helloworld)" \
20+
--output satis.json
21+
22+
# build public directory
23+
bin/satis-gitlab build --skip-errors satis.json public

.ci/template.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "mborne/demo-satis-gitlab",
3+
"homepage": "https://mborne.github.io/satis-gitlab/",
4+
"repositories": [
5+
{
6+
"type": "composer",
7+
"url": "https://packagist.org"
8+
}
9+
],
10+
"require": [],
11+
"require-dependencies": false,
12+
"require-dev-dependencies": false
13+
}

.github/workflows/demo-pages.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and publish demo on GitHub pages
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: "Setup PHP 8.3"
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 8.3
18+
19+
- name: Validate composer.json
20+
run: composer validate --strict
21+
22+
- name: Cache Composer packages
23+
id: composer-cache
24+
uses: actions/cache@v3
25+
with:
26+
path: vendor
27+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-php-
30+
31+
- name: Install dependencies
32+
run: composer install --prefer-dist --no-progress
33+
34+
- name: Build demo
35+
run: bash .ci/build-demo.sh
36+
env:
37+
SATIS_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Upload static files from public as artifact
40+
id: deployment
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: public/
44+
45+
# Deploy pages
46+
deploy:
47+
needs: build
48+
49+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
50+
permissions:
51+
pages: write # to deploy to Pages
52+
id-token: write # to verify the deployment originates from an appropriate source
53+
54+
# Deploy to the github-pages environment
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
59+
# Specify runner + deployment step
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/satis.json
44
/web/
55
/output/
6+
/public/
67

78
/composer.phar
89
/.phpunit.result.cache

0 commit comments

Comments
 (0)