diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml new file mode 100644 index 0000000..09da8af --- /dev/null +++ b/.github/workflows/create-version.yml @@ -0,0 +1,23 @@ +name: Create Version 🦉 + +on: + create: + # Triggered when a branch or tag is created + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Generate branch version string + run: | + BRANCH_NAME="${{ github.ref }}" + BRANCH_VERSION=$(echo $BRANCH_NAME | tr -cd '0-9.') + echo "BRANCH_VERSION=$BRANCH_VERSION" >> $GITHUB_ENV + + - name: Create version of docs for branch 🚀 + uses: readmeio/rdme@v8 + with: + rdme: versions:create ${{ env.BRANCH_VERSION }} --fork=1.0 --main=false --beta=true --deprecated=false --isPublic=false --key=${{ secrets.README_API_KEY }} diff --git a/.github/workflows/delete-version.yml b/.github/workflows/delete-version.yml new file mode 100644 index 0000000..bbe5a28 --- /dev/null +++ b/.github/workflows/delete-version.yml @@ -0,0 +1,24 @@ +name: Delete Version 🦉 + + +on: + pull_request: + types: [ closed ] + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Generate branch version string + run: | + BRANCH_NAME="${{ github.head_ref || github.ref || github.event.ref }}" + BRANCH_VERSION=$(echo $BRANCH_NAME | tr -cd '0-9.') + echo "BRANCH_VERSION=$BRANCH_VERSION" >> $GITHUB_ENV + + - name: Delete version of docs for branch (if branch is deleted) 🚀 + uses: readmeio/rdme@v8 + with: + rdme: versions:delete ${{ env.BRANCH_VERSION }} --key=${{ secrets.README_API_KEY }} diff --git a/.github/workflows/manage-docs.yml b/.github/workflows/manage-docs.yml deleted file mode 100644 index 97e87fc..0000000 --- a/.github/workflows/manage-docs.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Manage ReadMe Docs on Branch and PR Events - -on: - create: - # Triggered when a branch or tag is created - push: - branches-ignore: - - main - branches: - - '*' - pull_request: - types: [opened, reopened, closed] - # Triggered when a pull request is opened, reopened, or closed - delete: - # Triggered when a branch is deleted - -jobs: - manage-rdme-docs: - runs-on: ubuntu-latest - - steps: - - name: Check out repo 📚 - uses: actions/checkout@v3 - - - name: Generate branch version string - run: | - BRANCH_NAME="${{ github.head_ref || github.ref || github.event.ref }}" - BRANCH_VERSION=$(echo $BRANCH_NAME | tr -cd '0-9.') - echo "BRANCH_VERSION=$BRANCH_VERSION" >> $GITHUB_ENV - - - name: Create or Update version of docs for branch/PR (if push or PR open event) 🚀 - if: github.event_name == 'push' || github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') - uses: readmeio/rdme@v8 - with: - rdme: versions:create ${{ env.BRANCH_VERSION }} --fork=1.0 --main=false --beta=true --deprecated=false --isPublic=false --key=${{ secrets.README_API_KEY }} || \ - versions:update ${{ env.BRANCH_VERSION }} --fork=1.0 --main=false --beta=true --deprecated=false --isPublic=false --key=${{ secrets.README_API_KEY }} - - - name: Run `docs` command for branch/PR version (if push or PR open/synchronize event) 📝 - if: github.event_name == 'push' || github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') - uses: readmeio/rdme@v8 - with: - rdme: docs ${{ env.BRANCH_VERSION }} --version=${{ env.BRANCH_VERSION }} --key=${{ secrets.README_API_KEY }} - - - name: Delete version of docs for branch (if delete or PR merge event) 🚀 - if: github.event_name == 'delete' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) - uses: readmeio/rdme@v8 - with: - rdme: versions:delete ${{ env.BRANCH_VERSION }} --key=${{ secrets.README_API_KEY }} diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index d628adb..d0cab19 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -16,6 +16,12 @@ jobs: - name: Check out repo 📚 uses: actions/checkout@v3 + - name: Generate branch version string + run: | + BRANCH_NAME="${{ github.head_ref || github.ref || github.event.ref }}" + BRANCH_VERSION=$(echo $BRANCH_NAME | tr -cd '0-9.') + echo "BRANCH_VERSION=$BRANCH_VERSION" >> $GITHUB_ENV + - name: Run `docs` command 🚀 uses: readmeio/rdme@v8 with: diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000..a1b37c4 --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,21 @@ +name: Update ReadMe Docs on Push + +on: [push] + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Generate branch version string + run: | + BRANCH_NAME="${{ github.head_ref || github.ref || github.event.ref }}" + BRANCH_VERSION=$(echo $BRANCH_NAME | tr -cd '0-9.') + echo "BRANCH_VERSION=$BRANCH_VERSION" >> $GITHUB_ENV + + - name: Delete version of docs for branch (if branch is deleted) 🚀 + uses: readmeio/rdme@v8 + with: + rdme: docs ${{ env.BRANCH_VERSION }} --version=${{ env.BRANCH_VERSION }} --key=${{ secrets.README_API_KEY }} \ No newline at end of file