ci: build for 22.04 too #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build with Git 2.50.1 | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # 1. ADDED: Permissions to allow creating releases | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # 1) Check out your repo | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2) Install build dependencies | |
| - name: Install build dependencies for Git | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| libssl-dev \ | |
| libz-dev \ | |
| libcurl4-openssl-dev \ | |
| gettext \ | |
| asciidoc \ | |
| xmlto \ | |
| libexpat1-dev \ | |
| tar \ | |
| wget | |
| # 3) Download Git 2.50.1 source tarball | |
| - name: Download Git 2.50.1 | |
| run: | | |
| wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.50.1.tar.gz | |
| tar -xzf git-2.50.1.tar.gz | |
| # 4) Build and install Git 2.50.1 into /usr/local | |
| - name: Build and install Git 2.50.1 | |
| run: | | |
| cd git-2.50.1 | |
| make prefix=/usr/local all | |
| sudo make prefix=/usr/local install | |
| # 5) Make sure /usr/local/bin is preferred and show version | |
| - name: Verify Installation | |
| run: | | |
| export PATH=/usr/local/bin:$PATH | |
| git --version | |
| # --- NEW STEPS BELOW --- | |
| # 6) Package the build into a tarball for release | |
| - name: Package Artifacts | |
| run: | | |
| cd git-2.50.1 | |
| # Install to a temporary staging folder (DESTDIR) so we can zip just the new files | |
| mkdir -p ../git-release-build | |
| make prefix=/usr/local DESTDIR=$(pwd)/../git-release-build install | |
| # Create the tarball | |
| cd ../git-release-build | |
| tar -czvf ../git-2.50.1-linux-amd64.tar.gz . | |
| # 7) Push to GitHub Releases | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') # Only release if a tag is pushed | |
| with: | |
| files: git-2.50.1-linux-amd64.tar.gz | |
| # Optional: If you want a "Nightly" release on every push to main (since you trigger on main) | |
| - name: Update Nightly Release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref == 'refs/heads/main' | |
| with: | |
| tag_name: nightly-build-ubuntu22.04 | |
| name: Nightly Build (Git 2.50.1) (Ubuntu 22.04) | |
| draft: false | |
| prerelease: true | |
| overwrite: true | |
| files: git-2.50.1-linux-amd64.tar.gz |