Skip to content

Earthly build

Earthly build #2

name: Earthly build
on:
workflow_dispatch:
push:
branches: ['main']
tags: ['*']
pull_request:
schedule:
- cron: '0 11 * * *'
jobs:
build-testing-results:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up earthly
run: |
sudo wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly
sudo chmod 755 /usr/local/bin/earthly
- name: Build Space ROS
id: build
run: |
earthly --ci --output +sources
earthly --ci --output +build-testing
echo "archivename=$(basename log/build_results_archives/build_results_*.tar.bz2)" >> $GITHUB_ENV
- name: Upload build results archive
uses: actions/upload-artifact@v3
with:
name: ${{env.archivename}}
path: log/build_results_archives/${{env.archivename}}
if-no-files-found: error
space-ros-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up earthly
run: |
sudo wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly
sudo chmod 755 /usr/local/bin/earthly
- name: Build spaceros image
run: |
earthly --ci --output +sources
earthly --ci +image
- name: Push tagged spaceros images to Dockerhub
env:
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_RW_TOKEN }}
if: ${{ github.ref_type == 'tag' }}
run: |
echo $DOCKER_HUB_TOKEN | docker login --username osrfbot --password-stdin
earthly --ci --push +push-image --TAG="osrf/space-ros:${{ github.ref_name }}" --LATEST="osrf/space-ros:latest"
- name: Push the main spaceros image to GHCR
if: ${{ github.ref_name == 'main' }}
run: |
earthly --ci --push +push-image --TAG="ghcr.io/space-ros/space-ros:main" --LATEST=""