Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically create release for tags #319

Open
Flamefire opened this issue Feb 15, 2024 · 2 comments
Open

Automatically create release for tags #319

Flamefire opened this issue Feb 15, 2024 · 2 comments

Comments

@Flamefire
Copy link

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:

  •  on:
       push:
         tags:
           - 'v*'
    
  • actions/create-release
  • actions/upload-release-asset

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
Copy link
Member

bmario commented Feb 17, 2024

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

@Flamefire
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants