tud-zih-energy / lo2s

Linux OTF2 Sampling - A Lightweight Node-Level Performance Monitoring Tool
https://tu-dresden.de/zih/forschung/projekte/lo2s?set_language=en
GNU General Public License v3.0
44 stars 13 forks source link

Automatically create release for tags #319

Open Flamefire opened 5 months ago

Flamefire commented 5 months ago

The 1.7.0 release is missing the source bz2 (i.e. the one containing the submodules)

I'd say this should be automatically done. This could be made with GHA:

Not sure what make dist does and if it is required for that archive but if not actions/checkout with the recursive flag makes it easy to get a checkout including all submodules.

bmario commented 5 months ago

the tarball created by make dist includes submodules, while the default files created by github does not. So yes, it is required.

Flamefire commented 5 months ago

the tarball created by make dist includes submodules, while the default files created by github does not. So yes, it is required.

That's why I mentioned actions/checkout with the recursive flag (actually: with: submodules: True or with: submodules: recursive)

If all make dist does is to create the tarball from all files including the submodules then you could use something like the following instead of having to configure the build:

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    steps:
      - uses: actions/checkout@v2
        with:
          submodule: True
      - name: Create archive
        id: archive
        run: |
          NAME="lo2s-${GITHUB_REF#refs/tags/}"
          mkdir "/tmp/$NAME"
          cp -r * "/tmp/$NAME"
          mv "/tmp/$NAME" .
          tar -czf "$NAME.tar.gz" "$NAME"
          echo "::set-output name=src::$NAME.tar.gz"
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: Release of lo2s
          draft: false
          prerelease: false
      - name: Upload source distribution
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./${{steps.archive.outputs.src}}
          asset_name: ${{steps.archive.outputs.src}}
          asset_content_type: application/tar.gz

Note: I coded that up in this textfield copying code I used at other places with minor adjustment. So still needs double checking. see https://github.com/actions/checkout & https://github.com/actions/upload-release-asset