name: Build Archlinux-Base Image
run-name: Build Archlinux-Base Image
on:
  push:
    branches:
      - main

env:
  DOCKER_BUILDKIT: 1
  DOCKER_CLI_EXPERIMENTAL: enabled

jobs:
  base:
    runs-on: ubuntu-latest
    steps:
    - name: Clone repository
      uses: actions/checkout@v4
      with:
        lfs: true
    - name: Login to GiteaDockerRepo
      run: |
        docker login --username "${{ secrets.DOCKERHUB_USERNAME }}" --password "${{ secrets.DOCKERHUB_TOKEN }}" ${{ vars.currect_gitea_url }}        
    - name: Build latest Docker image and push to GiteaRepo
      run: |
        pwd
        ls
        docker build --network=host -t nebulabeat-mc:latest --no-cache .
        docker image tag nebulabeat-mc:latest ${{ vars.currect_gitea_url }}/vtbhelper/nebulabeat-mc:latest
        docker image push ${{ vars.currect_gitea_url }}/vtbhelper/nebulabeat-mc:latest
    - name: compress datapack
      run: |
        mkdir bin/
        cd extra/trinkets-fixed/
        zip -r ../../bin/trinkets-fixed.zip ./*
    - name: release datapack
      uses: akkuman/gitea-release-action@v1
      with:
        files: |-
          bin/**
        api_key: '${{ secrets.GITHUB_TOKEN }}'
