Compare commits
	
		
			2 Commits
		
	
	
		
			renovate/c
			...
			test-build
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					9ca9af0ab3 | ||
| 
						 | 
					0f5c7a81a2 | 
							
								
								
									
										48
									
								
								.github/workflows/build-container.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								.github/workflows/build-container.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					name: "Build container"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  containerization:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    permissions:
 | 
				
			||||||
 | 
					      packages: write
 | 
				
			||||||
 | 
					    strategy:
 | 
				
			||||||
 | 
					      fail-fast: false
 | 
				
			||||||
 | 
					      matrix:
 | 
				
			||||||
 | 
					        include:
 | 
				
			||||||
 | 
					          - arch: amd64
 | 
				
			||||||
 | 
					          - arch: arm64
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      - name: Install buildah
 | 
				
			||||||
 | 
					        run: sudo apt update && sudo apt install -y podman buildah qemu-user-static
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Set version tag (only if triggered by pushing a tag)
 | 
				
			||||||
 | 
					        if: startsWith(github.ref, 'refs/tags/v')
 | 
				
			||||||
 | 
					        run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Set latest tag (only if triggered by pushing to the main branch)
 | 
				
			||||||
 | 
					        if: github.ref == 'main'
 | 
				
			||||||
 | 
					        run: echo "TAG=latest" >> $GITHUB_ENV
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      - name: Set action link variable
 | 
				
			||||||
 | 
					        run: echo "LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Login in gchr registry
 | 
				
			||||||
 | 
					        run: buildah login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Build an image
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          buildah bud -t ghcr.io/${{ github.repository }}:${{ github.sha }}-${{ matrix.arch }} \
 | 
				
			||||||
 | 
					            --label action_id=${{ github.action }} \
 | 
				
			||||||
 | 
					            --label action_link=${{ env.LINK }} \
 | 
				
			||||||
 | 
					            --label actor=${{ github.actor }} \
 | 
				
			||||||
 | 
					            --label sha=${{ github.sha }} \
 | 
				
			||||||
 | 
					            --label ref=${{ github.ref }} \
 | 
				
			||||||
 | 
					            .
 | 
				
			||||||
							
								
								
									
										52
									
								
								.github/workflows/container-latest.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								.github/workflows/container-latest.yaml
									
									
									
									
										vendored
									
									
								
							@@ -1,52 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
name: "Latest container"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  push:
 | 
					 | 
				
			||||||
    branches:
 | 
					 | 
				
			||||||
      - main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  containerization:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    permissions:
 | 
					 | 
				
			||||||
      packages: write
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      - name: Checkout
 | 
					 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Set action link variable
 | 
					 | 
				
			||||||
        run: echo "LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Set up QEMU
 | 
					 | 
				
			||||||
        uses: docker/setup-qemu-action@master
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          platforms: all
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Set up Docker Buildx
 | 
					 | 
				
			||||||
        id: buildx
 | 
					 | 
				
			||||||
        uses: docker/setup-buildx-action@master
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Login to GitHub Container Registry
 | 
					 | 
				
			||||||
        uses: docker/login-action@v2
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          registry: ghcr.io
 | 
					 | 
				
			||||||
          username: ${{ github.repository_owner }}
 | 
					 | 
				
			||||||
          password: ${{ secrets.GITHUB_TOKEN }}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Build
 | 
					 | 
				
			||||||
        uses: docker/build-push-action@v3
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          builder: ${{ steps.buildx.outputs.name }}
 | 
					 | 
				
			||||||
          context: .
 | 
					 | 
				
			||||||
          file: ./Dockerfile
 | 
					 | 
				
			||||||
          platforms: linux/amd64,linux/arm64
 | 
					 | 
				
			||||||
          push: true
 | 
					 | 
				
			||||||
          tags: |
 | 
					 | 
				
			||||||
            ghcr.io/${{ github.repository }}:latest
 | 
					 | 
				
			||||||
          labels: |
 | 
					 | 
				
			||||||
            action_id=${{ github.action }}
 | 
					 | 
				
			||||||
            action_link=${{ env.LINK }}
 | 
					 | 
				
			||||||
            actor=${{ github.actor }}
 | 
					 | 
				
			||||||
            sha=${{ github.sha }}
 | 
					 | 
				
			||||||
            ref=${{ github.ref }}
 | 
					 | 
				
			||||||
							
								
								
									
										836
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										836
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,13 +1,14 @@
 | 
				
			|||||||
[package]
 | 
					[package]
 | 
				
			||||||
name = "dudo"
 | 
					name = "dudo"
 | 
				
			||||||
version = "0.2.2"
 | 
					version = "0.2.1"
 | 
				
			||||||
edition = "2021"
 | 
					edition = "2021"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
clap = { version = "4.1.1", features = ["derive", "env"] }
 | 
					clap = { version = "4.1.1", features = ["derive", "env"] }
 | 
				
			||||||
handlebars = "5.1.0"
 | 
					handlebars = "4.3.1"
 | 
				
			||||||
env_logger = "0.11.2"
 | 
					env_logger = "0.10.0"
 | 
				
			||||||
log = "0.4.17"
 | 
					log = "0.4.17"
 | 
				
			||||||
 | 
					http = "0.2.8"
 | 
				
			||||||
serde = { version = "1.0.126", features = ["derive"] }
 | 
					serde = { version = "1.0.126", features = ["derive"] }
 | 
				
			||||||
reqwest = { version = "0.11", features = ["json", "blocking", "rustls"] }
 | 
					reqwest = { version = "0.11", features = ["json", "blocking", "rustls"] }
 | 
				
			||||||
serde_yaml = "0.9"
 | 
					serde_yaml = "0.9"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
FROM rust:1.76.0-slim-bookworm as builder
 | 
					FROM registry.hub.docker.com/library/rust:1.70.0-slim-bookworm as builder
 | 
				
			||||||
WORKDIR /src
 | 
					WORKDIR /src
 | 
				
			||||||
RUN apt-get update &&\
 | 
					RUN apt-get update &&\
 | 
				
			||||||
		apt-get install -y libssl-dev gcc musl pkg-config
 | 
							apt-get install -y libssl-dev gcc musl pkg-config
 | 
				
			||||||
@@ -9,8 +9,8 @@ RUN cargo build --release --jobs 2 -Z sparse-registry
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
FROM debian:stable
 | 
					FROM debian:stable
 | 
				
			||||||
COPY --from=builder /src/target/release/dudo /bin/dudo
 | 
					COPY --from=builder /src/target/release/dudo /bin/dudo
 | 
				
			||||||
RUN apt-get update &&\
 | 
					RUN apt-get update -y &&\
 | 
				
			||||||
		apt-get install -y openssl ca-certificates &&\
 | 
							apt-get install openssl ca-certificates -y &&\
 | 
				
			||||||
		apt-get clean -y
 | 
							apt-get clean -y
 | 
				
			||||||
RUN chmod +x /bin/dudo
 | 
					RUN chmod +x /bin/dudo
 | 
				
			||||||
WORKDIR /workdir
 | 
					WORKDIR /workdir
 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "$schema": "https://docs.renovatebot.com/renovate-schema.json"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
use clap::Parser;
 | 
					use clap::Parser;
 | 
				
			||||||
use handlebars::Handlebars;
 | 
					use handlebars::Handlebars;
 | 
				
			||||||
 | 
					use http::StatusCode;
 | 
				
			||||||
use log::{error, info};
 | 
					use log::{error, info};
 | 
				
			||||||
use serde::{Deserialize, Serialize};
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -118,8 +119,8 @@ fn main() {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    info!("Running on {} {}", OS, ARCH);
 | 
					    info!("Running on {} {}", OS, ARCH);
 | 
				
			||||||
    let oss = config.os.get(&OS.to_string()).unwrap();
 | 
					    let oss = config.os.get(&OS.clone().to_string()).unwrap();
 | 
				
			||||||
    let archs = config.arch.get(&ARCH.to_string()).unwrap();
 | 
					    let archs = config.arch.get(&ARCH.clone().to_string()).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for arch in archs {
 | 
					    for arch in archs {
 | 
				
			||||||
        for os in oss {
 | 
					        for os in oss {
 | 
				
			||||||
@@ -133,7 +134,7 @@ fn main() {
 | 
				
			|||||||
            let link = reg.render("download_link", &values).unwrap();
 | 
					            let link = reg.render("download_link", &values).unwrap();
 | 
				
			||||||
            info!("Trying to download from {}", link.clone());
 | 
					            info!("Trying to download from {}", link.clone());
 | 
				
			||||||
            let mut resp = reqwest::blocking::get(link).unwrap();
 | 
					            let mut resp = reqwest::blocking::get(link).unwrap();
 | 
				
			||||||
            if resp.status().is_success() {
 | 
					            if resp.status() == StatusCode::OK {
 | 
				
			||||||
                info!("Response is 200, I'll try to download");
 | 
					                info!("Response is 200, I'll try to download");
 | 
				
			||||||
                let mut out =
 | 
					                let mut out =
 | 
				
			||||||
                    File::create(args.download_path.clone()).expect("failed to create file");
 | 
					                    File::create(args.download_path.clone()).expect("failed to create file");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user