-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Patrick José Pereira <[email protected]>
- Loading branch information
1 parent
bc3dc93
commit fe07a19
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
deploy-blueos-extension: | ||
runs-on: ubuntu-latest | ||
env: | ||
PLATFORMS: "linux/arm/v7,linux/arm64/v8" | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
|
||
steps: | ||
- name: Login to Docker Hub | ||
if: success() && github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Prepare | ||
id: prepare | ||
run: | | ||
# Deploy image with the name of the branch, if the build is a git tag, replace tag with the tag name. | ||
# If git tag matches semver, append latest tag to the push. | ||
DOCKER_IMAGE=${DOCKER_USERNAME:-bluerobotics}/blueos-jupyter | ||
VERSION=${GITHUB_REF##*/} | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
fi | ||
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}" | ||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | ||
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest" | ||
fi | ||
echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT | ||
echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
echo "buildx_args=${TAGS} --file Dockerfile ." >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: all | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
version: latest | ||
|
||
- name: Docker Buildx (build) | ||
run: | | ||
docker buildx build \ | ||
--output "type=image,push=false" \ | ||
--platform $PLATFORMS \ | ||
${{ steps.prepare.outputs.buildx_args }} | ||
- name: Docker Buildx (push) | ||
if: success() && github.event_name != 'pull_request' | ||
run: | | ||
docker buildx build \ | ||
--output "type=image,push=true" \ | ||
--platform $PLATFORMS \ | ||
${{ steps.prepare.outputs.buildx_args }} | ||
- name: Inspect image | ||
if: always() && github.event_name != 'pull_request' | ||
run: | | ||
docker buildx imagetools \ | ||
inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} |