Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #595 from XaverianTeamRobotics/docs/test-pages-on-…
Browse files Browse the repository at this point in the history
…docs-pr

Create an action for test deployments for docs builds
  • Loading branch information
MatthewL246 committed Nov 27, 2023
2 parents d3821b5 + a0e9e34 commit b8e2fbd
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 43 deletions.
28 changes: 16 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "daily"
interval: daily
allow:
- dependency-name: "*"
dependency-type: "all"
assignees: ["MatthewL246", "michaell4438"]
- dependency-name: '*'
dependency-type: all
assignees:
- MatthewL246
- michaell4438
open-pull-requests-limit: 10

- package-ecosystem: "gradle"
directory: "/"
- package-ecosystem: gradle
directory: /
schedule:
interval: "daily"
interval: daily
allow:
- dependency-name: "*"
dependency-type: "all"
assignees: ["MatthewL246", "michaell4438"]
- dependency-name: '*'
dependency-type: all
assignees:
- MatthewL246
- michaell4438
open-pull-requests-limit: 10
19 changes: 10 additions & 9 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,27 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
cache: "gradle"
java-version: 11
distribution: temurin
cache: gradle

- name: Build with Gradle
run: ./gradlew assembleDebug --scan --stacktrace --info --no-daemon -x test

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: "TeamCode-debug.apk"
path: "TeamCode/build/outputs/apk/debug/TeamCode-debug.apk"
name: TeamCode-debug.apk
path: TeamCode/build/outputs/apk/debug/TeamCode-debug.apk

release:
runs-on: ubuntu-latest
needs: ["build"]
needs:
- build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
concurrency:
group: "release"
cancel-in-progress: true
group: release
cancel-in-progress: false

steps:
- name: Checkout repository
Expand All @@ -45,7 +46,7 @@ jobs:
- name: Download the APK artifact
uses: actions/download-artifact@v3
with:
name: "TeamCode-debug.apk"
name: TeamCode-debug.apk

- name: Update the release tag
run: |
Expand Down
79 changes: 63 additions & 16 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

# Before changing any of these workflow triggers, make sure you understand the if statements for each of the jobs
on:
# Run automatically after the Android CI release finishes
workflow_run:
workflows: ["Android CI"]
branches: ["master"]
types: ["completed"]
workflows:
- Android CI
branches:
- master
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Run on pull requests to master
pull_request:
# Note that this specifies the target branch, not the branch that the PR is from
branches: ["master"]
branches:
- master

jobs:
build:
# Run if the Android CI build was successful, on PRs from docs/ branches, or if this is a manual workflow run
if: ${{ github.event.workflow_run.conclusion == 'success' || startsWith(github.head_ref, 'docs/') || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -30,9 +36,9 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
cache: "gradle"
java-version: 11
distribution: temurin
cache: gradle

- name: Build JavaDoc using Dokka
run: |
Expand All @@ -42,14 +48,15 @@ jobs:
- name: Upload Pages build artifact
uses: actions/upload-pages-artifact@v2
with:
name: "github-pages-build"
path: "./HelpPage/build"
name: github-pages-build
path: ./HelpPage/build
retention-days: 90

deploy:
# Only run deployment from the master branch and not on pull requests
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}
needs: ["build"]
needs:
- build
runs-on: ubuntu-latest
environment:
name: github-pages
Expand All @@ -61,16 +68,17 @@ jobs:
id-token: write
# Only allow one concurrent deployment
concurrency:
group: "pages"
group: pages-deploy
cancel-in-progress: false

steps:
- name: Configure Pages
uses: actions/configure-pages@v3

- name: Download Pages build artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: "github-pages-build"
name: github-pages-build

- name: Extract Pages build artifact
run: |
Expand All @@ -86,12 +94,51 @@ jobs:
- name: Upload final Pages artifact
uses: actions/upload-pages-artifact@v2
with:
name: "github-pages-deploy"
path: "./pages-build"
name: github-pages-deploy
path: ./pages-build
retention-days: 90

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
with:
artifact_name: "github-pages-deploy"
artifact_name: github-pages-deploy

test-deploy:
needs:
- build
runs-on: ubuntu-latest
# Only allow one concurrent test deployment per branch
concurrency:
group: pages-test-deploy-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Download Pages build artifact
uses: actions/download-artifact@v3
with:
name: github-pages-build

- name: Extract Pages build artifact
run: |
mkdir pages-build
tar -xvf artifact.tar -C pages-build
- name: Upload build to Cloudflare Pages
id: test-deployment
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: xbhs-robotics-docs
directory: pages-build

- name: Add comment with test deployment URL
if: ${{ github.event_name == 'pull_request' }}
run: >
gh pr comment ${{ github.event.number }}
--repo ${{ github.repository }}
--body "Your docs changes were built successfully!
View a preview of them at ${{ steps.test-deployment.outputs.url }}"
env:
GH_TOKEN: ${{ github.token }}
12 changes: 6 additions & 6 deletions HelpPage/doc/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ const config = {
position: "right",
items: [
{
href: "https://robotics.xbhs.net/apk",
href: "/apk/",
label: "Flash Robot Controller APK"
},
{
href: "https://robotics.xbhs.net/legacy-apk",
href: "/legacy-apk/",
label: "Download Driver Station APK"
},
{
href: "https://robotics.xbhs.net/imgutil",
href: "/imgutil/",
label: "Upload Images to robotics.xbhs.com"
},
]
Expand All @@ -130,15 +130,15 @@ const config = {
position: "right",
items: [
{
href: "https://robotics.xbhs.net/javadoc",
href: "/javadoc/",
label: "Javadoc (all)"
},
{
href: "https://robotics.xbhs.net/javadoc/-team-code/org.firstinspires.ftc.teamcode.features/index.html",
href: "/javadoc/-team-code/org.firstinspires.ftc.teamcode.features/index.html",
label: "Javadoc (features)"
},
{
href: "https://robotics.xbhs.net/javadoc/-team-code/org.firstinspires.ftc.teamcode.opmodes/index.html",
href: "/javadoc/-team-code/org.firstinspires.ftc.teamcode.opmodes/index.html",
label: "Javadoc (opmodes)"
},
]
Expand Down

0 comments on commit b8e2fbd

Please sign in to comment.