Skip to content

Build SampleProject to test the image #6

Build SampleProject to test the image

Build SampleProject to test the image #6

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags: [ '[0-9]+.[0-9]+.[0-9]+' ]
pull_request:
branches: [ main ]
env:
PUBLISH_IMAGE: ${{ startsWith(github.ref, 'refs/tags/') }}
DOCKERHUB_REPO: tenacom/buildvana-builder
TEST_TAG: tenacom/buildvana-builder:test
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate Docker metadata
id: meta
if: fromJSON(env.PUBLISH_IMAGE)
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_REPO }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and load into Docker
uses: docker/build-push-action@v5
with:
context: ./docker
load: true
tags: ${{ env.TEST_TAG }}
- name: Test
run: docker run --rm -v "${{ github.workspace}}:/app" ${{ env.TEST_TAG }} tenacom/buildvana-builder:test bash -c "(cd SampleProject && dotnet tool restore && dotnet cake --target pack)"
- name: Build and push
if: fromJSON(env.PUBLISH_IMAGE)
uses: docker/build-push-action@v5
with:
context: ./docker
push: ${{ env.PUBLISH_IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}