feat: set DOCKER_MODE=1 in Dockerfile template #85
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| permissions: | |
| contents: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: kdeps/kdeps | |
| jobs: | |
| unit-tests: | |
| strategy: | |
| matrix: | |
| platform: | |
| # TODO: Enable windows tests once pkl on support on Windows platform is fixed | |
| # [ubuntu-24.04, ubuntu-22.04, macos-latest, macos-14, windows-2022] | |
| [ubuntu-24.04, ubuntu-22.04, macos-latest, macos-14] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # TODO: Replace with actions/setup-go once issue is resolved https://github.com/actions/setup-go/pull/515 | |
| - name: Setup Go | |
| uses: antontroshin/setup-go@windows-go-mod-cache | |
| with: | |
| go-version-file: "go.mod" | |
| cache-dependency-path: "go.sum" | |
| - name: Install pkl on Linux | |
| if: startsWith(matrix.platform, 'ubuntu') | |
| run: | | |
| mkdir -p ~/.local/bin | |
| ARCH=$(uname -m) | |
| echo "Detected architecture: $ARCH" | |
| if [ "$ARCH" = "arm64" ]; then | |
| curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-linux-aarch64' | |
| elif [ "$ARCH" = "x86_64" ]; then | |
| curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-linux-amd64' | |
| else | |
| echo "Unsupported architecture: $ARCH" && exit 1 | |
| fi | |
| chmod +x ~/.local/bin/pkl | |
| echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
| export PATH=$HOME/.local/bin:$PATH | |
| pkl --version | |
| shell: bash | |
| - name: Install pkl on macOS | |
| if: startsWith(matrix.platform, 'macos') | |
| run: | | |
| mkdir -p ~/.local/bin | |
| ARCH=$(uname -m) | |
| echo "Detected architecture: $ARCH" | |
| if [ "$ARCH" = "arm64" ]; then | |
| curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-macos-aarch64' | |
| elif [ "$ARCH" = "x86_64" ]; then | |
| curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-macos-amd64' | |
| else | |
| echo "Unsupported architecture: $ARCH" && exit 1 | |
| fi | |
| chmod +x ~/.local/bin/pkl | |
| echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
| export PATH=$HOME/.local/bin:$PATH | |
| pkl --version | |
| shell: bash | |
| - name: Install pkl on Windows | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| Write-Host "Downloading PKL..." | |
| Invoke-WebRequest 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-windows-amd64.exe' -OutFile pkl.exe | |
| if (!(Test-Path .\pkl.exe)) { | |
| Write-Host "pkl.exe not found!" | |
| exit 1 | |
| } | |
| echo "PATH=$env:GITHUB_WORKSPACE;$env:PATH" >> $env:GITHUB_ENV | |
| .\pkl.exe --version | |
| shell: pwsh | |
| - run: make test | |
| - name: Install winget | |
| if: matrix.platform == 'windows-2022' | |
| uses: Cyberboss/install-winget@v1 | |
| prepare-darwin: | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Workaround Git Security Warning | |
| run: | | |
| # Workaround a bug in github actions: | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - uses: actions/setup-go@v4 | |
| with: | |
| go-version-file: "go.mod" | |
| cache-dependency-path: "go.sum" | |
| - shell: bash | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: cache darwin | |
| uses: actions/cache@v3 | |
| with: | |
| path: dist/darwin | |
| key: darwin-${{ env.sha_short }} | |
| - name: Run GoReleaser | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| docker run --privileged --entrypoint /bin/bash -v /var/run/docker.sock:/var/run/docker.sock -e GGOOS=darwin -e GORELEASER_KEY=${{ secrets.GORELEASER_KEY }} -e COMMIT_SHA=${{ github.sha }} -e VERSION=${{ github.ref_name }} -e GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} -v $(pwd):/src -w /src ghcr.io/goreleaser/goreleaser-cross-pro:v1.25.2 -c " | |
| apt-get update && apt-get install -y libssl1.1 || | |
| (wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && | |
| dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb) && | |
| git config --global --add safe.directory /src && | |
| goreleaser release --clean --split --verbose | |
| " | |
| prepare-linux: | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Workaround Git Security Warning | |
| run: | | |
| # Workaround a bug in github actions: | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - uses: actions/setup-go@v4 | |
| with: | |
| go-version-file: "go.mod" | |
| cache-dependency-path: "go.sum" | |
| - shell: bash | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: cache linux | |
| uses: actions/cache@v3 | |
| with: | |
| path: dist/linux | |
| key: linux-${{ env.sha_short }} | |
| - name: Run GoReleaser | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| docker run --privileged --entrypoint /bin/bash -v /var/run/docker.sock:/var/run/docker.sock -e GGOOS=linux -e GORELEASER_KEY=${{ secrets.GORELEASER_KEY }} -e COMMIT_SHA=${{ github.sha }} -e VERSION=${{ github.ref_name }} -e GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} -v $(pwd):/src -w /src ghcr.io/goreleaser/goreleaser-cross-pro:v1.25.2 -c " | |
| apt-get update && apt-get install -y libssl1.1 || | |
| (wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && | |
| dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb) && | |
| git config --global --add safe.directory /src && | |
| goreleaser release --clean --split --verbose | |
| " | |
| release-unix: | |
| runs-on: ubuntu-latest | |
| needs: [prepare-linux, prepare-darwin] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Workaround Git Security Warning | |
| run: | | |
| # Workaround a bug in github actions: | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - shell: bash | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - uses: actions/cache@v3 | |
| with: | |
| path: dist/linux | |
| key: linux-${{ env.sha_short }} | |
| - uses: actions/cache@v3 | |
| with: | |
| path: dist/darwin | |
| key: darwin-${{ env.sha_short }} | |
| - uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| distribution: goreleaser-pro | |
| version: v2.12.5 | |
| args: continue --merge | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
| release-windows: | |
| runs-on: windows-latest | |
| needs: [prepare-linux, prepare-darwin] | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: UCRT64 | |
| update: true | |
| install: git mingw-w64-ucrt-x86_64-gcc | |
| # TODO: Replace with actions/setup-go once issue is resolved https://github.com/actions/setup-go/pull/515 | |
| - name: Setup Go | |
| uses: antontroshin/setup-go@windows-go-mod-cache | |
| with: | |
| go-version-file: "go.mod" | |
| cache-dependency-path: "go.sum" | |
| - name: Release | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| version: v2.12.5 | |
| distribution: goreleaser-pro | |
| args: release --clean --split | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
| VERSION: ${{ github.ref_name }} | |
| COMMIT_SHA: ${{ github.sha }} | |
| GGOOS: windows | |
| - name: Upload binaries to release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.RELEASE_TOKEN }} | |
| file: dist/windows/kdeps_Windows_x86_64.zip | |
| asset_name: kdeps_Windows_x86_64.zip | |
| tag: ${{ github.ref }} | |
| overwrite: false | |
| make_latest: false | |
| prerelease: false | |
| dockerBuild: | |
| runs-on: ubuntu-latest | |
| name: Docker Build | |
| needs: [release-windows, release-unix] | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: kdeps | |
| password: ${{ secrets.RELEASE_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| VERSION=${{ github.ref_name }} | |
| install-windows: | |
| runs-on: windows-latest | |
| name: Installer Script on Windows | |
| needs: [release-windows, release-unix] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use install script | |
| shell: bash | |
| run: curl -LsSf https://raw.githubusercontent.com/kdeps/kdeps/refs/heads/main/install.sh | sh -s -- -d ${GITHUB_REF##*/} | |
| - name: Install pkl | |
| run: | | |
| curl -L -o /c/Users/runneradmin/.local/bin/pkl.exe 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-windows-amd64.exe' | |
| chmod +x /c/Users/runneradmin/.local/bin/pkl.exe | |
| /c/Users/runneradmin/.local/bin/pkl.exe --version | |
| shell: bash | |
| - name: Create .kdeps.pkl configuration file | |
| shell: bash | |
| run: | | |
| mkdir -p ~/.kdeps | |
| cat << EOF > ~/.kdeps.pkl | |
| amends "package://schema.kdeps.com/[email protected]#/Kdeps.pkl" | |
| runMode = "docker" | |
| dockerGPU = "cpu" | |
| kdepsDir = ".kdeps" | |
| kdepsPath = "user" | |
| EOF | |
| - name: Install winget | |
| uses: Cyberboss/install-winget@v1 | |
| continue-on-error: true | |
| # TODO: This is disabled for now due to ongoing Windows support. | |
| # - name: Test Pipeline | |
| # shell: bash | |
| # run: /c/Users/runneradmin/.local/bin/kdeps.exe | |
| install-unix: | |
| runs-on: ubuntu-latest | |
| name: Installer Script on Linux | |
| needs: [release-windows, release-unix] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract tag from ref | |
| id: extract_tag | |
| run: | | |
| ref_name="${GITHUB_REF##*/}" | |
| echo "tag=${ref_name}" >> $GITHUB_ENV | |
| - name: Use install script | |
| run: curl -LsSf https://raw.githubusercontent.com/kdeps/kdeps/refs/heads/main/install.sh | sh -s -- -d ${{ env.tag }} | |
| - name: Determine architecture and install pkl | |
| run: | | |
| ARCH=$(uname -m) | |
| if [ "$ARCH" = "aarch64" ]; then | |
| curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-linux-aarch64' | |
| elif [ "$ARCH" = "x86_64" ]; then | |
| curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.1/pkl-linux-amd64' | |
| else | |
| echo "Unsupported architecture: $ARCH" && exit 1 | |
| fi | |
| chmod +x ~/.local/bin/pkl | |
| ~/.local/bin/pkl --version | |
| - name: Create .kdeps.pkl configuration file | |
| run: | | |
| echo 'amends "package://schema.kdeps.com/[email protected]#/Kdeps.pkl"' > ~/.kdeps.pkl | |
| pkl eval ~/.kdeps.pkl >> ~/.kdeps.pkl | |
| - name: Test Pipeline | |
| run: kdeps | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [install-unix, install-windows, dockerBuild] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Extract tag from ref | |
| id: extract_tag | |
| run: | | |
| ref_name="${GITHUB_REF##*/}" | |
| echo "tag=${ref_name}" >> $GITHUB_ENV | |
| - name: Release promote to latest | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: ${{ secrets.RELEASE_TOKEN }} | |
| tag_name: ${{ env.tag }} | |
| prerelease: false | |
| make_latest: true | |
| clear_attachments: false |