Updated dependency injection page #579
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
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/github-action@v1.9.0 | |
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@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
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@v3 | |
- 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@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
context: . | |
file: ./deployment/Dockerfile |