-
Notifications
You must be signed in to change notification settings - Fork 32
98 lines (86 loc) · 3.4 KB
/
website.yml
File metadata and controls
98 lines (86 loc) · 3.4 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build and deploy website
on:
push:
# Trigger on new version tags (supports both 1.2 and 1.2.0 formats)
tags:
- "*.*.*"
- "*.*"
# Trigger on pushes to the main branch to update existing docs
branches:
- main
pull_request:
# Trigger on pull requests targeting the main branch
branches:
- main
# Allow manual runs from the Actions tab
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for versioning
- name: Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
pixi-version: v0.68.1
cache: true
- name: Configure Git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Install website dependencies
run: pixi run -e website site-install
- name: Build documentation for PR Preview
if: github.event_name == 'pull_request'
run: pixi run -e website site-build
- name: Upload artifact for pull request review
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: docs-preview
path: website/build/
retention-days: 7
- name: Determine Version
id: get_version
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION_NAME="${{ github.ref_name }}"
echo "Triggered by tag push. Deploying new version: $VERSION_NAME"
else
echo "Triggered by branch/manual push. Finding latest tag to update..."
VERSION_NAME=$(git describe --tags --abbrev=0)
if [[ -z "$VERSION_NAME" ]]; then
echo "::error::No tags found in history. Cannot determine version to update."
exit 1
fi
echo "Found latest version to update: $VERSION_NAME"
fi
echo "version=$VERSION_NAME" >> $GITHUB_OUTPUT
if [[ "$VERSION_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+- ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Configure SSH
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository == 'barebaric/rayforge'
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.WEBSITE_DEPLOY_KEY }}
- name: Add github.com to known_hosts
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository == 'barebaric/rayforge'
run: ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Deploy Website
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository == 'barebaric/rayforge'
env:
DEPLOY_VERSION: ${{ steps.get_version.outputs.version }}
DEPLOY_REPO_URL: git@github.com:barebaric/rayforge-website.git
DEPLOY_BRANCH: main
IS_TAGGED_RELEASE: ${{ github.ref_type == 'tag' }}
IS_PRERELEASE: ${{ steps.get_version.outputs.is_prerelease }}
run: pixi run -e website site-deploy