always build on main and tags and PRs

This commit is contained in:
Eugene Dementyev
2023-07-24 22:23:14 +12:00
parent 947746e4f1
commit 2d905e50c9

View File

@@ -7,16 +7,11 @@ on:
- 'v*'
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io/fleetbase
jobs:
build:
name: Build and Start Docker Services
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
@@ -27,34 +22,8 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
# this will be replaced by docker buildx bake with an empty line
# to get just tags without the image name
images: |
willbereplaced
tags: |
type=edge,branch=main
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and release
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && success()
env:
# get tags from the json object and pass as a string-encoded list
tags: "${{ toJSON(fromJSON(steps.meta.outputs.json).tags) }}"
uses: docker/bake-action@v2
with:
push: true
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}