name: Create Release
on: 
  push:
    tags:
    - '*'
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
    - uses: https://gitea.com/actions/checkout@master
    - name: Zip Artifacts
      uses: https://github.com/thedoctor0/zip-release@master
      with:
        type: 'zip'
        filename: 'server.zip'
        exclusions: '*.git*'
    - name: Release Archive
      uses: https://gitea.com/actions/gitea-release-action@v1
      with:
        server_url: https://gitea.wpgcommunity.net
        files: 'server.zip'
  docker:
    runs-on: ubuntu-latest
    steps:
    - uses: https://gitea.com/actions/checkout@master
    - name: Docker meta
      id: meta
      uses: docker/metadata-action@v5
      with:
        images: |
          ${{ vars.DOCKER_REPO }}/costhive
        config-inline: |
          [registry.${{ vars.DOCKER_REPO }}]
            http = true
            insecure = true
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
    - name: Build and push
      uses: https://github.com/docker/build-push-action@v6
      with:
        push: true
        context: .
        tags: ${{ steps.meta.outputs.tags }}