Update documentation job to use prepare job output

This commit is contained in:
Pavel Penev
2023-11-21 10:21:30 +02:00
committed by Gustas
parent 54c2f7d2b4
commit c80020f451

View File

@@ -93,30 +93,19 @@ jobs:
docs: docs:
name: Update docs.openra.net name: Update docs.openra.net
needs: prepare
if: github.repository == 'openra/openra' if: github.repository == 'openra/openra'
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Prepare environment variables - name: Debug output
run: | run: |
if [ "${{ github.event_name }}" = "push" ]; then echo ${{ needs.prepare.outputs.git_tag }}
if [ "${{ github.ref_type }}" = "tag" ]; then echo ${{ needs.prepare.outputs.version_type }}
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 - name: Clone Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: ${{ env.GIT_TAG }} ref: ${{ needs.prepare.outputs.git_tag }}
- name: Install .NET 6 - name: Install .NET 6
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
@@ -127,21 +116,21 @@ jobs:
run: | run: |
make all make all
# VERSION is release/playtest/bleed - the name of the target branch. # version_type is release/playtest/bleed - the name of the target branch.
- name: Clone docs.openra.net - name: Clone docs.openra.net
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: openra/docs repository: openra/docs
token: ${{ secrets.DOCS_TOKEN }} token: ${{ secrets.DOCS_TOKEN }}
path: docs path: docs
ref: ${{ env.VERSION }} ref: ${{ needs.prepare.outputs.version_type }}
- name: Generate docs files - name: Generate docs files
run: | run: |
./utility.sh all --docs "${{ env.GIT_TAG }}" | python3 ./packaging/format-docs.py > "docs/api/traits.md" ./utility.sh all --docs "${{ needs.prepare.outputs.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 --weapon-docs "${{ needs.prepare.outputs.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 --sprite-sequence-docs "${{ needs.prepare.outputs.git_tag }}" | python3 ./packaging/format-docs.py > "docs/api/sprite-sequences.md"
./utility.sh all --lua-docs "${{ env.GIT_TAG }}" > "docs/api/lua.md" ./utility.sh all --lua-docs "${{ needs.prepare.outputs.git_tag }}" > "docs/api/lua.md"
- name: Update docs.openra.net - name: Update docs.openra.net
run: | run: |
@@ -149,5 +138,5 @@ jobs:
git config --local user.email "actions@github.com" git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions" git config --local user.name "GitHub Actions"
git add api/*.md git add api/*.md
git commit -m "Update auto-generated documentation for ${{ env.GIT_TAG }}" git commit -m "Update auto-generated documentation for ${{ needs.prepare.outputs.git_tag }}"
git push origin ${{ env.VERSION }} git push origin ${{ needs.prepare.outputs.version_type }}