Skip to content

Commit d1d26e7

Browse files
committed
chore: add continuous deployment
1 parent eba3bf2 commit d1d26e7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Build Docker image
20+
run: docker build -t scotlandphp-builder .
21+
22+
- name: Run build in Docker container
23+
run: |
24+
docker run --rm \
25+
-v ${{ github.workspace }}:/app \
26+
-w /app \
27+
scotlandphp-builder \
28+
sh -c "composer install && php vendor/bin/robo build --dist"
29+
30+
- name: Fix permissions
31+
run: sudo chown -R $USER:$USER dist
32+
33+
- name: Deploy to GitHub Pages
34+
run: |
35+
cd dist
36+
echo 'community.scotlandphp.co.uk' > CNAME
37+
git init
38+
git config user.name "github-actions[bot]"
39+
git config user.email "github-actions[bot]@users.noreply.github.com"
40+
git add -A
41+
git commit -m "Deploy to GitHub Pages: ${{ github.sha }}"
42+
git push -f https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:gh-pages

0 commit comments

Comments
 (0)