fixed setup #54
Workflow file for this run
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 Push Container | |
'on': | |
push: | |
branches: | |
- release # Trigger on pushes to the main branch | |
tags: | |
- v* # Trigger on version tags like v1.0.0 | |
workflow_dispatch: null # Allows manual trigger from the GitHub UI | |
jobs: | |
build-and-push-src-in-container: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Dockerfile | |
run: | | |
echo "FROM scratch" > Dockerfile | |
echo "COPY . /src" >> Dockerfile | |
- name: Extract version or set default | |
id: get_version | |
shell: bash | |
run: | | |
VERSION=$(git describe --tags --abbrev=0 --always) | |
if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-(alpha|beta) ]]; then | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
else | |
echo "version=latest" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ github.repository_owner }}/k4all:${{ steps.get_version.outputs.version }} | |
- name: Update GitHub Deployment Status | |
run: | | |
echo "Container released: ghcr.io/${{ github.repository_owner }}/k4all:${{ steps.get_version.outputs.version }}" |