-
-
Notifications
You must be signed in to change notification settings - Fork 116
129 lines (117 loc) · 4.18 KB
/
build.yml
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: build
on: [push, pull_request, workflow_dispatch]
env:
REGISTRY: ghcr.io
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: spongepowered/spongedocs
jobs:
build:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.variables.outputs.branch }}
version: ${{ steps.variables.outputs.version }}
versions: ${{ steps.variables.outputs.versions }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: 'pip'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test build
run: sphinx-build -W -d build/doctrees source build/html
- name: Build translation files
run: sphinx-build -W -q -b gettext source build/locale
- name: Set crowdin branch
id: variables
if: github.ref_name == 'stable' || startsWith(github.ref_name, 'release-')
run: |
echo "Ref: $GITHUB_REF"
BRANCH=${GITHUB_REF##*/}
echo "Branch: $BRANCH"
echo "::set-output name=branch::$(echo $BRANCH)"
VERSION="${BRANCH##*-}"
echo "Current Version: $VERSION"
echo "::set-output name=version::$(echo $VERSION)"
VERSIONS=$(list-versions)
echo "Available Versions: $VERSIONS"
echo "::set-output name=versions::$(echo $VERSIONS)"
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
- name: Upload to crowdin
uses: crowdin/[email protected]
if: github.ref_name == 'stable' || startsWith(github.ref_name, 'release-')
with:
crowdin_branch_name: ${{ steps.variables.outputs.version }}
config: 'crowdin.yaml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
CROWDIN_BASE_URL: https://spongepowered.crowdin.com
publish-docker:
runs-on: ubuntu-latest
if: github.ref_name == 'stable' || startsWith(github.ref_name, 'release-')
needs: build
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build.outputs.version }}
build-args: |
GITHUB_USER=SpongePowered
GITHUB_TOKEN=${{ github.token }}
GITHUB_REPO=SpongeDocs
GITHUB_VERSION=${{ needs.build.outputs.branch }}
CROWDIN_TOKEN=${{ secrets.CROWDIN_TOKEN }}
CROWDIN_PROJECT_ID=${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_BASE_URL=https://spongepowered.crowdin.com
VERSION=${{ needs.build.outputs.version }}
publish-docker-all:
runs-on: ubuntu-latest
if: github.ref_name == 'stable'
needs: [build, publish-docker]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate Dockerfile
run: ./deployment/generate-dockerfile.sh
env:
GITHUB_USER: SpongePowered
GITHUB_TOKEN: ${{ github.token }}
VERSIONS: ${{ needs.build.outputs.versions }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
context: .
file: ./deployment/Dockerfile