Files
Fleetbase-Mirror-Repo/.github/workflows/ci.yml
2023-05-29 14:58:11 +08:00

57 lines
1.4 KiB
YAML

name: Fleetbase CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build:
name: Build and Start Docker Services
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Build and Start Docker Services
run: |
docker-compose up -d --build
publish:
if: startsWith(github.ref, 'refs/tags/')
name: Push Docker image to Docker Hub
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: your-dockerhub-username/your-repo-name:${{ steps.get_version.outputs.VERSION }}