github.com/nuvolaris/nuv@v0.0.0-20240511174247-a74e3a52bfd8/bin/linux/nuvfile.yml (about)

     1  # Licensed to the Apache Software Foundation (ASF) under one
     2  # or more contributor license agreements.  See the NOTICE file
     3  # distributed with this work for additional information
     4  # regarding copyright ownership.  The ASF licenses this file
     5  # to you under the Apache License, Version 2.0 (the
     6  # "License"); you may not use this file except in compliance
     7  # with the License.  You may obtain a copy of the License at
     8  #
     9  #   http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing,
    12  # software distributed under the License is distributed on an
    13  # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    14  # KIND, either express or implied.  See the License for the
    15  # specific language governing permissions and limitations
    16  # under the License.
    17  
    18  version: '3'
    19  
    20  vars:
    21    ARCH: "{{ARCH}}"
    22    VERSION:
    23      sh: cat version.txt || echo "unknown" 
    24  
    25  tasks:
    26  
    27    build:
    28      desc: build installer
    29      cmds:
    30      - test "{{OS}}" = "linux"
    31      - task: download
    32      - task: assemble
    33  
    34    download: 
    35      - curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh | GH=mh-cbon/go-bin-deb sh -xe
    36      - sudo apt-get -y install alien
    37  
    38    assemble:
    39      - rm -r deb-build-{{.ARCH}}
    40      - go-bin-deb generate -a {{.ARCH}} --version {{.VERSION}} --wd deb-build-{{.ARCH}}
    41      - task: assemble-rpm
    42  
    43    assemble-rpm:
    44      - |
    45        export VERSION="{{.VERSION}}"
    46        export VER="${VERSION%%-*}"
    47        export REL="${VERSION##*.}"
    48        export ARCH="{{.ARCH}}"
    49        case "$ARCH" in
    50          arm64) export TGT="aarch64" ;;
    51          amd64) export TGT="x86_64" ;;
    52        esac
    53        case "$(lsb_release -rs)" in
    54          20.*) IMG="rockylinux:8" ;;
    55          22.*) IMG="rockylinux:9" ;;
    56        esac
    57        cd $NUV_ROOT/linux
    58        sudo alien --to-rpm "nuv_${VERSION}_${ARCH}.deb" --scripts --generate
    59        cat nuv-${VER}/nuv-${VER}-*.spec |\
    60        grep -v '%dir "/"' |\
    61        sed -e "s/Release:.*/Release: $REL/" >nuv.spec
    62        cat rpmbuild.sh | docker run -i -v $PWD:/mnt "$IMG" env VER=$VER TGT=$TGT bash -
    63        sudo mv nuv-${VER}-*.$TGT.rpm nuv_${VERSION}_${ARCH}.rpm
    64  
    65    clean: rm -r *.deb *.rpm deb-build-{{.ARCH}}
    66  
    67    info:
    68    - echo "ARCH:" "{{.ARCH}}"
    69    - echo "VERSION:" "{{.VERSION}}"
    70