name: Release

on:
  release:
    types: [published]

permissions:
  contents: write

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: deps
      run: sudo apt-get install libgcrypt20-dev xa65 doxygen graphviz
    - uses: actions/checkout@v6
      with:
        submodules: 'true'
        ref: ${{ github.ref }}
    - name: Bootstrap
      run: autoreconf -vfi
    - name: Configure
      run: ./configure
    - name: Prepare package
      id: package-generator
      run: |
        make dist
        RELEASE_TARBALL=$(ls libresidfp-*.tar.gz)
        echo "filename=${RELEASE_TARBALL}" >> $GITHUB_OUTPUT
    - name: Upload to release
      uses: JasonEtco/upload-to-release@master
      with:
        args: ${{ steps.package-generator.outputs.filename }} application/gzip
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#    - name: Prepare docs
#      run: make doc
#    - name: Deploy docs
#      uses: peaceiris/actions-gh-pages@v4
#      with:
#        publish_dir: ./docs/html
#        destination_dir: html
#        commit_message: Update docs
#        github_token: ${{ secrets.GITHUB_TOKEN }}
