Create main.yml #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build driver | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'releases/**' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch tags | |
run: git fetch --tags --force | |
# From https://github.com/pguyot/arm-runner-action/blob/main/.github/workflows/test-cache.yml | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: $RUNNER_TEMP/photon_libcam_builder.img | |
key: ${{ hashFiles('**/*.yml') }} | |
- uses: pguyot/arm-runner-action@HEAD | |
id: install_deps | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
# we don't want to optimize as it's two-stage | |
optimize_image: no | |
image_additional_mb: 1500 | |
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz | |
commands: | | |
./install_pi.sh | |
- name: Move and rename image with dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
export IMAGE=photonvision_$(git describe --tags --match=v*).img | |
mv ${{ steps.install_deps.outputs.image }} $RUNNER_TEMP/$IMAGE | |
tar -cJf $IMAGE.tar.xz $RUNNER_TEMP/$IMAGE | |
- uses: actions/upload-artifact@master | |
with: | |
name: photon-image | |
path: "*.tar.xz" | |
# Push to dev release on pushes to master | |
- uses: pyTooling/Actions/releaser@r0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: 'Dev' | |
rm: true | |
files: | | |
*.tar.xz | |
if: github.event_name == 'push' | |
# Push to actual release, if tagged | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
*.tar.xz | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |