name: Deploy Documentation on: push: branches: [ bleed ] tags: [ 'release-*', 'playtest-*' ] workflow_dispatch: inputs: tag: description: 'Git Tag' required: true default: 'release-xxxxxxxx' permissions: contents: read # to fetch code (actions/checkout) jobs: wiki: name: Update Wiki if: github.repository == 'openra/openra' runs-on: ubuntu-22.04 steps: - name: Clone Repository uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.tag }} - name: Install .NET 6 uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' - name: Prepare Environment run: | make all - name: Clone Wiki uses: actions/checkout@v3 with: repository: openra/openra.wiki token: ${{ secrets.DOCS_TOKEN }} path: wiki - name: Update Wiki (Playtest) if: startsWith(github.event.inputs.tag, 'playtest-') env: GIT_TAG: ${{ github.event.inputs.tag }} run: | ./utility.sh all --settings-docs "${GIT_TAG}" > "wiki/Settings (playtest).md" - name: Update Wiki (Release) if: startsWith(github.event.inputs.tag, 'release-') env: GIT_TAG: ${{ github.event.inputs.tag }} run: | ./utility.sh all --settings-docs "${GIT_TAG}" > "wiki/Settings.md" - name: Push Wiki env: GIT_TAG: ${{ github.event.inputs.tag }} run: | cd wiki git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" git add --all git commit -m "Update auto-generated documentation for ${GIT_TAG}" git push origin master docs: name: Update docs.openra.net if: github.repository == 'openra/openra' runs-on: ubuntu-22.04 steps: - name: Prepare environment variables run: | if [ "${{ github.event_name }}" = "push" ]; then if [ "${{ github.ref_type }}" = "tag" ]; then VERSION=`echo "${GITHUB_REF#refs/tags/}" | cut -d"-" -f1` echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV else echo "GIT_TAG=bleed" >> $GITHUB_ENV echo "VERSION=bleed" >> $GITHUB_ENV fi else VERSION=`echo "${{ github.event.inputs.tag }}" | cut -d"-" -f1` echo "GIT_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV fi - name: Clone Repository uses: actions/checkout@v3 with: ref: ${{ env.GIT_TAG }} - name: Install .NET 6 uses: actions/setup-dotnet@v3 with: dotnet-version: '6.0.x' - name: Prepare Environment run: | make all # VERSION is release/playtest/bleed - the name of the target branch. - name: Clone docs.openra.net uses: actions/checkout@v3 with: repository: openra/docs token: ${{ secrets.DOCS_TOKEN }} path: docs ref: ${{ env.VERSION }} - name: Generate docs files run: | ./utility.sh all --docs "${{ env.GIT_TAG }}" | python3 ./packaging/format-docs.py > "docs/api/traits.md" ./utility.sh all --weapon-docs "${{ env.GIT_TAG }}" | python3 ./packaging/format-docs.py > "docs/api/weapons.md" ./utility.sh all --sprite-sequence-docs "${{ env.GIT_TAG }}" | python3 ./packaging/format-docs.py > "docs/api/sprite-sequences.md" ./utility.sh all --lua-docs "${{ env.GIT_TAG }}" > "docs/api/lua.md" - name: Update docs.openra.net run: | cd docs git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" git add api/*.md git commit -m "Update auto-generated documentation for ${{ env.GIT_TAG }}" git push origin ${{ env.VERSION }}