Skip to content

feat: container push ci #1

feat: container push ci

feat: container push ci #1

Workflow file for this run

name: Containerize Sylva
on:
push:
branches:
- master
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Authenticate with Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Authenticate with the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine release type
run: |
if [[ ${{ github.event_name }} == 'release' ]]; then
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
echo "RELEASE_TYPE=prerelease" >> $GITHUB_ENV
else
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
echo "TAG_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
fi
else
echo "RELEASE_TYPE=preview" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Sylva CLI to Docker Hub (stable)
uses: docker/build-push-action@v6
with:
push: true
target: cli-prod
tags: |
${{ vars.DOCKERHUB_USERNAME }}/sylva:latest
${{ vars.DOCKERHUB_USERNAME }}/sylva:${{ env.TAG_VERSION }}
ghcr.io/${{ vars.DOCKERHUB_USERNAME }}/sylva:latest
ghcr.io/${{ vars.DOCKERHUB_USERNAME }}/sylva:${{ env.TAG_VERSION }}
if: ${{ env.RELEASE_TYPE == 'release' }}
- name: Build and push Sylva CLI to Docker Hub (preview)
uses: docker/build-push-action@v6
with:
push: true
target: cli-prod
tags: |
${{ vars.DOCKERHUB_USERNAME }}/sylva:preview
ghcr.io/${{ vars.DOCKERHUB_USERNAME }}/sylva:preview
if: ${{ env.RELEASE_TYPE == 'prerelease' || env.RELEASE_TYPE == 'preview' }}