name: Release on: push: tags: - "*.*.*" # Trigger on any semantic version tag (e.g., 1.0.0, 2.1.3) workflow_dispatch: inputs: version: description: "Version to release (e.g., 1.0.0)" required: true type: string jobs: release: runs-on: [ubuntu-latest] steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Gitea Container Registry uses: docker/login-action@v3 with: registry: git.allucanget.biz username: ${{ secrets.CI_REGISTRY_USER }} password: ${{ secrets.CI_REGISTRY_TOKEN }} - name: Extract version id: version run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then VERSION="${{ github.event.inputs.version }}" else VERSION="${GITHUB_REF#refs/tags/}" fi if [[ -z "$VERSION" ]]; then echo "::error::VERSION is empty. Provide a version via workflow_dispatch input or push a tag." exit 1 fi echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Releasing version: $VERSION" - name: Print version to gitea runner log run: | echo "Releasing version: ${{ steps.version.outputs.version }}" echo "===DEBUG===" echo "VERSION: $VERSION" echo "GITHUB_REF: $GITHUB_REF" echo "steps.version.outputs.version: ${{ steps.version.outputs.version }}" echo "github.event_name: ${{ github.event_name }}" - name: Extract metadata for Playout id: meta-playout uses: docker/metadata-action@v5 with: images: git.allucanget.biz/zwitschi/linearvoid/playout tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest - name: Build and push Playout image uses: docker/build-push-action@v5 with: context: ./backend/playout push: true tags: ${{ steps.meta-playout.outputs.tags }} labels: ${{ steps.meta-playout.outputs.labels }} cache-from: type=registry,ref=git.allucanget.biz/zwitschi/linearvoid/buildcache:playout cache-to: type=registry,ref=git.allucanget.biz/zwitschi/linearvoid/buildcache:playout,mode=max - name: Extract metadata for Chat id: meta-chat uses: docker/metadata-action@v5 with: images: git.allucanget.biz/zwitschi/linearvoid/chat tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest - name: Build and push Chat image uses: docker/build-push-action@v5 with: context: ./backend/chat push: true tags: ${{ steps.meta-chat.outputs.tags }} labels: ${{ steps.meta-chat.outputs.labels }} cache-from: type=registry,ref=git.allucanget.biz/zwitschi/linearvoid/buildcache:chat cache-to: type=registry,ref=git.allucanget.biz/zwitschi/linearvoid/buildcache:chat,mode=max - name: Extract metadata for Nginx id: meta-nginx uses: docker/metadata-action@v5 with: images: git.allucanget.biz/zwitschi/linearvoid/nginx tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest - name: Build and push Nginx image uses: docker/build-push-action@v5 with: context: . file: infrastructure/nginx/Dockerfile push: true tags: ${{ steps.meta-nginx.outputs.tags }} labels: ${{ steps.meta-nginx.outputs.labels }} cache-from: type=registry,ref=git.allucanget.biz/zwitschi/linearvoid/buildcache:nginx cache-to: type=registry,ref=git.allucanget.biz/zwitschi/linearvoid/buildcache:nginx,mode=max - name: Create Release on Gitea run: | curl -X POST "https://git.allucanget.biz/api/v1/repos/zwitschi/linearvoid/releases" \ -H "Authorization: token ${{ secrets.CI_REGISTRY_TOKEN }}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${{ steps.version.outputs.version }}\",\"name\":\"${{ steps.version.outputs.version }}\",\"body\":\"Release ${{ steps.version.outputs.version }}\n\nSee [CHANGELOG.md](https://git.allucanget.biz/zwitschi/linearvoid/src/branch/main/CHANGELOG.md) for details.\",\"draft\":false,\"prerelease\":false}"