name: Release artifacts on: release: types: [published] workflow_dispatch: jobs: source-tarball: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v5 with: fetch-depth: 0 submodules: recursive - name: Populate git info in version.h.in run: | git fetch --tags --unshallow || true COMMIT_HASH=$(git rev-parse HEAD) BRANCH="${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD)}" COMMIT_MSG=$(git show -s --format=%s | sed 's/[&/]/\\&/g') COMMIT_DATE=$(git show -s --format=%cd --date=local) GIT_DIRTY=$(git diff-index --quiet HEAD -- && echo "clean" || echo "dirty") GIT_TAG=$(git describe --tags --always || echo "unknown") GIT_COMMITS=$(git rev-list --count HEAD) echo "Branch: $BRANCH" echo "Tag: $GIT_TAG" sed -i \ -e "s|@GIT_COMMIT_HASH@|$COMMIT_HASH|" \ -e "s|@GIT_BRANCH@|$BRANCH|" \ -e "s|@GIT_COMMIT_MESSAGE@|$COMMIT_MSG|" \ -e "s|@GIT_COMMIT_DATE@|$COMMIT_DATE|" \ -e "s|@GIT_DIRTY@|$GIT_DIRTY|" \ -e "s|@GIT_TAG@|$GIT_TAG|" \ -e "s|@GIT_COMMITS@|$GIT_COMMITS|" \ src/version.h.in - name: Create tarball with submodules id: tar run: | mkdir hyprland-source; mv ./* ./hyprland-source || tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz * - id: whatrelease name: Get latest release uses: pozetroninc/github-action-get-latest-release@master with: owner: hyprwm repo: Hyprland excludes: prerelease, draft - name: Upload to release id: upload uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: source.tar.gz asset_name: source-${{ steps.whatrelease.outputs.release }}.tar.gz tag: ${{ steps.whatrelease.outputs.release }} overwrite: true