Skip to content

ci: re-fix version detection #41

ci: re-fix version detection

ci: re-fix version detection #41

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
docker-build-and-push:
name: Build and push
runs-on: ubuntu-latest
steps:
# Not needed since build-push-action will clone
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: open-turo/actions-release/semantic-release@v3
id: semantic-release
with:
github-token: ${{ secrets.GHA_TOKEN }}
dry-run: true
- name: Set release version
id: set-release-version
run: |
version="${{ steps.semantic-release.outputs.new-release-version }}"
if [[ -n "$version" ]]; then
echo "New version: $version"
echo "release-version=$version" >> "$GITHUB_OUTPUT"
else
echo "No new version"
echo "release-version=latest" >> "$GITHUB_OUTPUT"
fi
- uses: docker/build-push-action@v5
with:
build-args: GITHUB_TOKEN=${{ secrets.GHA_TOKEN }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: linux/amd64
push: true
tags: |
${{ github.repository }}:build-${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
${{ github.repository }}:${{ steps.set-release-version.outputs.release-version }}