build-trigger #104
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 and upload Docker for Scout | |
on: | |
push: | |
branches: | |
- main | |
repository_dispatch: | |
types: build-trigger | |
jobs: | |
devops: | |
name: Docker image build | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
images: | |
- scout | |
steps: | |
- uses: actions/checkout@v2 | |
if: ${{ github.event_name == 'push' || github.event_name =='repository_dispatch'}} | |
with: | |
ref: main | |
- name: Free Disk space | |
run: | | |
sudo swapoff -a | |
sudo rm -f /swapfile | |
sudo rm -rf /opt/hostedtoolcache | |
sudo apt clean | |
docker rmi $(docker image ls -aq) | |
df -h | |
# Build images | |
- name: Build images | |
run: | | |
# Build Image | |
bash ./build.sh ${{ matrix.images }} | |
# Log into image registries | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: wildmeorg | |
password: ${{ secrets.WBIA_WILDMEBOT_DOCKER_HUB_TOKEN }} | |
- name: Push to Docker Hub (Latest) | |
if: ${{ github.event_name == 'push' || github.event_name =='repository_dispatch' }} | |
run: | | |
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##') | |
bash ./publish.sh -t latest ${PUBLISH_IMAGES} | |
env: | |
PUBLISH_IMAGES: ${{ matrix.images }} scout | |