name: LANCommander Release on: push: tags: - 'v*.*.*' - 'v*.*.*-*' env: REGISTRY: docker.io IMAGE_NAME: lancommander/lancommander permissions: contents: write packages: write id-token: write attestations: write jobs: # -------------------------------------------------------------------------- # 1) PREP JOB: figure out the latest semver, build nightly version, # check if there are commits since the last nightly tag. If none, # skip the rest of the workflow. # -------------------------------------------------------------------------- prep: runs-on: ubuntu-latest outputs: version_tag: ${{ steps.trim_tag_ref.outputs.replaced }} version_semver: ${{ steps.trim_tag_ref.outputs.replaced }} is_prerelease: ${{ steps.check_prerelease.outputs.is_prerelease }} build_dotnet_version: 9.0.102 steps: - name: Check out code uses: actions/checkout@v4 with: # Ensure we get all tags so we can find the latest fetch-depth: 0 - uses: frabert/replace-string-action@v2 name: Trim Tag Ref id: trim_tag_ref with: string: '${{ github.ref }}' pattern: 'refs/tags/v' replace-with: '' - name: Check if pre-release id: check_prerelease run: | VERSION="${{ steps.trim_tag_ref.outputs.replaced }}" if [[ "$VERSION" == *-* ]]; then echo "is_prerelease=true" >> $GITHUB_OUTPUT else echo "is_prerelease=false" >> $GITHUB_OUTPUT fi # Server build_server_linux_arm64: needs: [prep] uses: ./.github/workflows/LANCommander.Server.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: linux-arm64 build_arch: arm64 build_platform: Linux build_configuration: Release build_server_linux_x64: needs: [prep] uses: ./.github/workflows/LANCommander.Server.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: linux-x64 build_arch: x64 build_platform: Linux build_configuration: Release build_server_osx_arm64: needs: [prep] uses: ./.github/workflows/LANCommander.Server.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: osx-arm64 build_arch: arm64 build_platform: macOS build_configuration: Release build_server_osx_x64: needs: [prep] uses: ./.github/workflows/LANCommander.Server.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: osx-x64 build_arch: x64 build_platform: macOS build_configuration: Release build_server_win_arm64: needs: [prep] uses: ./.github/workflows/LANCommander.Server.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: win-arm64 build_arch: arm64 build_platform: Windows build_configuration: Release build_server_win_x64: needs: [prep] uses: ./.github/workflows/LANCommander.Server.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: win-x64 build_arch: x64 build_platform: Windows build_configuration: Release # Launcher build_launcher_linux_arm64: needs: [prep] uses: ./.github/workflows/LANCommander.Launcher.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: linux-arm64 build_arch: arm64 build_platform: Linux build_configuration: Release build_launcher_linux_x64: needs: [prep] uses: ./.github/workflows/LANCommander.Launcher.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: linux-x64 build_arch: x64 build_platform: Linux build_configuration: Release build_launcher_osx_arm64: needs: [prep] uses: ./.github/workflows/LANCommander.Launcher.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: osx-arm64 build_arch: arm64 build_platform: macOS build_configuration: Release build_launcher_osx_x64: needs: [prep] uses: ./.github/workflows/LANCommander.Launcher.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: osx-x64 build_arch: x64 build_platform: macOS build_configuration: Release build_launcher_win_arm64: needs: [prep] uses: ./.github/workflows/LANCommander.Launcher.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: win-arm64 build_arch: arm64 build_platform: Windows build_configuration: Release build_launcher_win_x64: needs: [prep] uses: ./.github/workflows/LANCommander.Launcher.yml with: build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }} version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_runtime: win-x64 build_arch: x64 build_platform: Windows build_configuration: Release # Packager (Windows x86 only) build_packager: needs: [prep] uses: ./.github/workflows/LANCommander.Packager.yml with: build_dotnet_version: '10.0.x' version_semver: ${{ needs.prep.outputs.version_semver }} version_tag: ${{ needs.prep.outputs.version_tag }} build_configuration: Release build_release: runs-on: ubuntu-latest needs: - prep - build_server_linux_arm64 - build_server_linux_x64 - build_server_osx_arm64 - build_server_osx_x64 - build_server_win_arm64 - build_server_win_x64 - build_launcher_linux_arm64 - build_launcher_linux_x64 - build_launcher_osx_arm64 - build_launcher_osx_x64 - build_launcher_win_arm64 - build_launcher_win_x64 - build_packager steps: - name: Create Temp Directory run: mkdir -p artifacts - name: Download Server Linux ARM64 uses: actions/download-artifact@v4 with: name: LANCommander.Server-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Server Linux x64 uses: actions/download-artifact@v4 with: name: LANCommander.Server-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Server macOS ARM64 uses: actions/download-artifact@v4 with: name: LANCommander.Server-macOS-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Server macOS x64 uses: actions/download-artifact@v4 with: name: LANCommander.Server-macOS-x64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Server Windows ARM64 uses: actions/download-artifact@v4 with: name: LANCommander.Server-Windows-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Server Windows x64 uses: actions/download-artifact@v4 with: name: LANCommander.Server-Windows-x64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts # Launcher artifacts - name: Download Launcher Linux ARM64 uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Launcher Linux x64 uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Launcher macOS ARM64 uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-macOS-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Launcher macOS x64 uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-macOS-x64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Launcher Windows ARM64 uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-Windows-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Launcher Windows x64 uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-Windows-x64-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Download Launcher Linux ARM64 AppImage uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.AppImage path: artifacts - name: Download Launcher Linux x64 AppImage uses: actions/download-artifact@v4 with: name: LANCommander.Launcher-Linux-x64-v${{ needs.prep.outputs.version_tag }}.AppImage path: artifacts - name: Download Packager Windows x86 uses: actions/download-artifact@v4 with: name: LANCommander.Packager-Windows-x86-v${{ needs.prep.outputs.version_tag }}.zip path: artifacts - name: Debug - List Artifact Files run: | echo "Contents of ./artifacts:" ls -la ./artifacts - name: Draft Release uses: softprops/action-gh-release@v2 with: name: v${{ needs.prep.outputs.version_tag }} generate_release_notes: true draft: true prerelease: ${{ needs.prep.outputs.is_prerelease == 'true' }} files: | artifacts/LANCommander.Server-Windows-arm64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Server-Windows-x64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Server-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Server-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Server-macOS-arm64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Server-macOS-x64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-macOS-arm64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-macOS-x64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-Windows-arm64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-Windows-x64-v${{ needs.prep.outputs.version_tag }}.zip artifacts/LANCommander.Launcher-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.AppImage artifacts/LANCommander.Launcher-Linux-x64-v${{ needs.prep.outputs.version_tag }}.AppImage artifacts/LANCommander.Packager-Windows-x86-v${{ needs.prep.outputs.version_tag }}.zip - name: Checkout Repo for Docker build uses: actions/checkout@v4 - name: Download Server x64 Artifacts uses: actions/download-artifact@v4 with: name: LANCommander.Server-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip path: ./ - name: Extract Server Artifacts run: | mkdir -p ./LANCommander.Server/published unzip ./LANCommander.Server-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip -d ./LANCommander.Server/published - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable={{is_default_branch}} - name: Download Server x64 Artifacts uses: actions/download-artifact@v4 with: name: LANCommander.Server-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip path: ./ - name: Download Server arm64 Artifacts uses: actions/download-artifact@v4 with: name: LANCommander.Server-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.zip path: ./ - name: Extract Server Artifacts x64 run: | mkdir -p ./LANCommander.Server/published-amd64 unzip ./LANCommander.Server-Linux-x64-v${{ needs.prep.outputs.version_tag }}.zip -d ./LANCommander.Server/published-amd64 - name: Extract Server Artifacts arm64 run: | mkdir -p ./LANCommander.Server/published-arm64 unzip ./LANCommander.Server-Linux-arm64-v${{ needs.prep.outputs.version_tag }}.zip -d ./LANCommander.Server/published-arm64 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Setup buildx uses: docker/setup-buildx-action@v3 with: platforms: linux/amd64,linux/arm64 - name: Build and push Docker image id: push uses: docker/build-push-action@v6 with: context: ./LANCommander.Server file: ./LANCommander.Server/Dockerfile push: true platforms: linux/amd64 tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:v${{ needs.prep.outputs.version_tag }} ${{ needs.prep.outputs.is_prerelease == 'true' && format('{0}/{1}:prerelease', env.REGISTRY, env.IMAGE_NAME) || format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | VERSION=${{ needs.prep.outputs.version_tag }} BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") provenance: true - name: Generate artifact attestation uses: actions/attest-build-provenance@v2 with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true