Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Push image to Docker Hub
run: |
docker login -u kkittur -p ${{ secrets.DOCKER_HUB_TOKEN }}
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u kkittur --password-stdin
docker push kkittur/drivebrain_cross_compile:latest

build-executable:
Expand All @@ -27,23 +27,17 @@ jobs:
uses: actions/checkout@v4

- name: Pull from container registry
run: |
docker pull kkittur/drivebrain_cross_compile:latest
run: docker pull kkittur/drivebrain_cross_compile:latest

- name: Enter container and build
run: |
docker compose run --rm dev ./build_script.sh

- name: Extract binary from build
run: |
docker compose run --rm dev cp build-arm/drivebrain /app/drivebrain-arm
run: docker compose run --rm dev ./build_script.sh

- name: Upload build artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: drivebrain-arm-binary
path: drivebrain-arm
path: build-arm/drivebrain

create-release:
needs: [publish-image, build-executable]
Expand All @@ -56,18 +50,24 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Determine next version
id: version
run: |
git fetch --tags
LATEST=$(git tag -l 'v[0-9]*' | sort -t'v' -k2 -n | tail -1)
git fetch --tags --force
LATEST=$(git tag -l 'v*' | grep -E '^v[0-9]+$' | sort -V | tail -1)
if [ -z "$LATEST" ]; then
NEXT="v1"
else
NUM=${LATEST#v}
NUM="${LATEST#v}"
NEXT="v$((NUM + 1))"
fi
if [ -z "$NEXT" ] || ! echo "$NEXT" | grep -qE '^v[0-9]+$'; then
echo "ERROR: computed tag '$NEXT' is invalid"
exit 1
fi
echo "Computed next version: $NEXT"
echo "tag=$NEXT" >> "$GITHUB_OUTPUT"

- name: Download build artifact
Expand All @@ -79,14 +79,14 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ steps.version.outputs.tag }} \
gh release create "${{ steps.version.outputs.tag }}" \
--title "Release ${{ steps.version.outputs.tag }}" \
--generate-notes \
drivebrain-arm
drivebrain

- name: Tag and push versioned Docker image
run: |
docker login -u kkittur -p ${{ secrets.DOCKER_HUB_TOKEN }}
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u kkittur --password-stdin
docker pull kkittur/drivebrain_cross_compile:latest
docker tag kkittur/drivebrain_cross_compile:latest kkittur/drivebrain_cross_compile:${{ steps.version.outputs.tag }}
docker push kkittur/drivebrain_cross_compile:${{ steps.version.outputs.tag }}
docker tag kkittur/drivebrain_cross_compile:latest "kkittur/drivebrain_cross_compile:${{ steps.version.outputs.tag }}"
docker push "kkittur/drivebrain_cross_compile:${{ steps.version.outputs.tag }}"
Loading