diff --git a/.github/workflows/deploy-linux.yml b/.github/workflows/deploy-linux.yml index 2b51115..2029458 100644 --- a/.github/workflows/deploy-linux.yml +++ b/.github/workflows/deploy-linux.yml @@ -3,6 +3,9 @@ name: Build Linux Binary on: push: branches: [ main, master ] + push: + tags: + - 'v*' workflow_dispatch: inputs: version: @@ -89,16 +92,23 @@ jobs: retention-days: 30 - name: Create and Upload to GitHub Release - if: github.event_name == 'release' || github.event.inputs.create_release == 'true' + if: github.event_name == 'release' || github.event.inputs.create_release == 'true' || startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + # Create release if it doesn't exist if [ "${{ github.event.inputs.create_release }}" = "true" ] && [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "Creating release for ${{ env.VERSION }}" gh release create ${{ env.VERSION }} \ --title "PPanel Server ${{ env.VERSION }}" \ --notes "Release ${{ env.VERSION }}" \ --latest + elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_type }}" = "tag" ]; then + echo "Creating release for tag ${{ env.VERSION }}" + gh release create ${{ env.VERSION }} \ + --title "PPanel Server ${{ env.VERSION }}" \ + --notes "Release ${{ env.VERSION }}" \ + --latest fi echo "Uploading binaries to release ${{ env.VERSION }}"