name: Pull request github actions

on:
  pull_request:
    branches:
      - '*'

jobs:
  build-devel:
    runs-on: ubuntu-latest
    steps:
    - name: Get current date
      run: echo "irgsh_build_date=$(TZ='Asia/Jakarta' date +'%Y%m%d%H%M')" >> $GITHUB_ENV
    - uses: actions/checkout@v4
    - name: Install needed apt packages
      uses: awalsh128/cache-apt-pkgs-action@v1.6.0
      with:
        packages: gpg pbuilder debootstrap devscripts python3-apt reprepro make
        version: 1.0
    - uses: actions/setup-go@v4
      with:
        go-version: '1.13.14'
    - uses: actions/cache@v4
      with:
        path: |
          ~/.cache/go-build
          ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-go-
    - name: Build development release
      run: |
        echo ${{ env.irgsh_build_date }}-development-build > VERSION
        make release
        mv target/{release,pre-release}.tar.gz
    - uses: actions/upload-artifact@v4
      with:
        name: pre-release.tar.gz
        path: target/
