Skip to content

Commit

Permalink
Only build the JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Nov 6, 2024
1 parent f833cee commit 0cf0000
Showing 1 changed file with 10 additions and 56 deletions.
66 changes: 10 additions & 56 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,77 +142,27 @@ jobs:
with:
fetch-depth: 0

# Configure our SSH private key for pushing to the vendor repo
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.VENDOR_JSON_REPO_PUSH_KEY }}
- name: Checkout vendor-jsons
uses: actions/checkout@v4
with:
repository: PhotonVision/vendor-json-repo
path: vendor-json-repo

- name: Install Java 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin

# grab all tags
- run: git fetch --tags --force

# Generate the JSON and give it the ""standard""" name maven gives it
- run: |
chmod +x gradlew
./gradlew photon-lib:generateVendorJson
mv photon-lib/build/generated/vendordeps/photonlib.json photon-lib/build/generated/vendordeps/photonlib-json-1.0.json
export VERSION=$(git describe --tags --match=v*)
mv photon-lib/build/generated/vendordeps/photonlib.json photon-lib/build/generated/vendordeps/photonlib-$(git describe --tags --match=v*).json
# Upload it here so it shows up in releases
- uses: actions/upload-artifact@v4
with:
name: photonlib-vendor-json
path: photon-lib/build/generated/vendordeps/photonlib-json-1.0.json

- run: find .
working-directory: vendor-json-repo

- run: |
export VERSION=$(git describe --tags --match=v*)
cd vendor-json-repo
git switch -C photonlib-$VERSION
- run: git status
working-directory: vendor-json-repo

- run: |
export VERSION=$(git describe --tags --match=v*)
cp photon-lib/build/generated/vendordeps/photonlib-json-1.0.json vendor-json-repo/2025/photonlib-$(git describe --tags --match=v*).json
name: Copy new JSON over
# apparently we have to push or gh pr create gets upset
- name: Commit and push
run: |
export VERSION=$(git describe --tags --match=v*)
cd vendor-json-repo
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add .
git commit -m "Update vendor JSON to $VERSION"
git remote -v
git remote set-url origin [email protected]:PhotonVision/vendor-json-repo.git
git push --set-upstream origin photonlib-$VERSION -f
# Cut a new release
- run: |
export VERSION=$(git describe --tags --match=v*)
cd vendor-json-repo
echo "${{ secrets.VENDOR_JSON_REPO_PUSH_TOKEN }}" > token.txt
gh auth login --with-token < token.txt
rm token.txt
gh pr create --repo photonvision/vendor-json-repo --title "Update PhotonLib to $VERSION" --body "Automatic vendor JSON update" --base main --head photonvision:$(git branch --show-current)
name: Create GH PR to the vendor-json-repo
# Only on tags
if: startsWith(github.ref, 'refs/tags/v')
path: photon-lib/build/generated/vendordeps/photonlib-*.json

build-photonlib-host:
env:
Expand Down Expand Up @@ -574,7 +524,7 @@ jobs:
name: image-${{ matrix.image_suffix }}
path: photonvision*.xz
release:
needs: [build-package, build-image, combine]
needs: [build-package, build-image, combine, build-photonlib-vendorjson]
runs-on: ubuntu-22.04
steps:
# Download all fat JARs
Expand All @@ -592,6 +542,10 @@ jobs:
with:
merge-multiple: true
pattern: image-*
# Download maven
- uses: actions/download-artifact@v4
with:
pattern: photonlib-vendor-json

- run: find
# Push to dev release
Expand Down

0 comments on commit 0cf0000

Please sign in to comment.