Call publish workflow for apt #47
Workflow file for this run
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 and release Git-Mastery CLI | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| packages: read | ||
| issues: read | ||
| jobs: | ||
| linux-build: | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, ubuntu-24.04-arm] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v3 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| - name: Get binary name | ||
| id: binary-name | ||
| env: | ||
| OS_VERSION: ${{ matrix.os }} | ||
| run: | | ||
| if [ $OS_VERSION = "ubuntu-latest" ]; then | ||
| ARCHITECTURE=amd64 | ||
| else | ||
| ARCHITECTURE=arm64 | ||
| fi | ||
| FILENAME=gitmastery-${GITHUB_REF_NAME#v}-linux-$ARCHITECTURE | ||
| echo "binary=$FILENAME" >> $GITHUB_OUTPUT | ||
| - name: Build binary | ||
| env: | ||
| BINARY_NAME: ${{ steps.binary-name.outputs.binary }} | ||
| run: | | ||
| pyinstaller --onefile main.py --name $BINARY_NAME | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: dist/${{ steps.binary-name.outputs.binary }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Publish package as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ steps.binary-name.outputs.binary }} | ||
| path: dist/${{ steps.binary-name.outputs.binary }} | ||
| debian-build: | ||
| needs: linux-build | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, ubuntu-24.04-arm] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: "app" | ||
| - name: Extract variables | ||
| env: | ||
| ARCHITECTURE: ${{ matrix.architecture }} | ||
| OS_VERSION: ${{ matrix.os }} | ||
| run: | | ||
| if [ $OS_VERSION = "ubuntu-latest" ]; then | ||
| ARCHITECTURE=amd64 | ||
| else | ||
| ARCHITECTURE=arm64 | ||
| fi | ||
| echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV | ||
| echo "ARCHITECTURE=${ARCHITECTURE}" >> $GITHUB_ENV | ||
| # Get the tag's commit message | ||
| cd app/ | ||
| CHANGELOG_MESSAGE=$(git show ${GITHUB_REF_NAME} --no-patch --pretty=format:%s) | ||
| echo "CHANGELOG_MESSAGE=${CHANGELOG_MESSAGE}" >> $GITHUB_ENV | ||
| - name: Install Debian packaging tools | ||
| run: | | ||
| sudo apt-get install devscripts build-essential debhelper-compat | ||
| - name: Create folder structure for ${{ env.ARCHITECTURE }} distribution | ||
| run: | | ||
| mkdir gitmastery-${VERSION}-${ARCHITECTURE} | ||
| - name: Download ${{ env.ARCHITECTURE }} binaries from artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: gitmastery-${{ env.VERSION }}-linux-${{ env.ARCHITECTURE }} | ||
| path: gitmastery-${{ env.VERSION }}-${{ env.ARCHITECTURE }}/ | ||
| - name: Create upstream tarball .orig.tar.gz | ||
| run: | | ||
| # Create .orig.tar.gz file | ||
| tar -czf gitmastery_${VERSION}.orig.tar.gz gitmastery-${VERSION}-${ARCHITECTURE}/gitmastery-${VERSION}-linux-${ARCHITECTURE} | ||
| tree | ||
| - name: Generate Debian packaging files | ||
| working-directory: gitmastery-${{ env.VERSION }}-${{ env.ARCHITECTURE }} | ||
| # TODO: Update to something agnostic | ||
| env: | ||
| EMAIL: woojiahao1234@gmail.com | ||
| NAME: Jiahao, Woo | ||
| run: | | ||
| file gitmastery-${VERSION}-linux-${ARCHITECTURE} | ||
| # Create the debian folder | ||
| mkdir debian | ||
| # Generate the changelog | ||
| # TODO: Maybe detect if major version change, then make it urgent | ||
| dch --create -v ${VERSION}-1 -u low --package gitmastery $CHANGELOG_MESSAGE | ||
| # Create the control file | ||
| # TODO: Maybe detect if major version change, then make it mandatory | ||
| echo """Source: gitmastery | ||
| Maintainer: $NAME <$EMAIL> | ||
| Section: misc | ||
| Priority: optional | ||
| Standards-Version: 4.7.0 | ||
| Build-Depends: debhelper-compat (= 13) | ||
| Package: gitmastery | ||
| Architecture: ${ARCHITECTURE} | ||
| Depends: ${shlibs:Depends}, ${misc:Depends}, libc6 (>= 2.35), python3 | ||
| Description: execute Git-Mastery | ||
| gitmastery is a Git learning tool built by the National University of Singapore School of Computing | ||
| """ > debian/control | ||
| # Copy over the MIT license from the main app to this release | ||
| cat ../app/LICENSE > debian/copyright | ||
| mkdir debian/source | ||
| echo "3.0 (quilt)" > debian/source/format | ||
| # Provide the rules for installation, using -e to preserve the tab character as per: | ||
| # https://wiki.debian.org/Packaging/Intro | ||
| echo -e $"""#!/usr/bin/make -f | ||
| %: | ||
| \tdh \$@ | ||
| \n | ||
| override_dh_auto_install: | ||
| \tinstall -D -m 0755 gitmastery-${VERSION}-linux-${ARCHITECTURE} debian/gitmastery/usr/bin/gitmastery | ||
| """ > debian/rules | ||
| echo """usr/bin | ||
| """ > debian/gitmastery.dirs | ||
| mkdir -p debian/source | ||
| echo """gitmastery-${VERSION}-linux-${ARCHITECTURE} | ||
| """ > debian/source/include-binaries | ||
| cat debian/rules | ||
| # Build the package | ||
| dpkg-buildpackage -us -uc -a ${ARCHITECTURE} | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: gitmastery_${{ env.VERSION }}-1_${{ env.ARCHITECTURE }}.deb | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| debian-publish-apt: | ||
| needs: debian-build | ||
| uses: git-mastery/gitmastery-apt-repo/.github/workflows/debian-apt-repo.yml@main | ||
| with: | ||
| version: ${{ env.VERSION }} | ||
|
Check failure on line 189 in .github/workflows/publish.yml
|
||
| secrets: inherit | ||
| windows: | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v3 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| - name: Build binary | ||
| run: | | ||
| pyinstaller --onefile --name gitmastery main.py | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: dist/gitmastery.exe | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| macos: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v3 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| - name: Build binary | ||
| run: | | ||
| pyinstaller --onefile --name gitmastery main.py | ||
| - name: Generate SHA256 | ||
| id: checksum | ||
| run: | | ||
| FILENAME=gitmastery | ||
| SHA256=$(shasum -a 256 dist/$FILENAME | cut -d ' ' -f1) | ||
| echo "sha256=$SHA256" >> $GITHUB_OUTPUT | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: dist/gitmastery | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Update Homebrew Tap | ||
| env: | ||
| GH_TOKEN: ${{ secrets.ORG_PAT }} | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git clone https://x-access-token:${GH_TOKEN}@github.com/git-mastery/homebrew-gitmastery.git | ||
| cd homebrew-gitmastery | ||
| ls | ||
| cat <<EOF > gitmastery.rb | ||
| class Gitmastery < Formula | ||
| desc "CLI tool for Git-Mastery" | ||
| homepage "https://github.com/git-mastery/cli" | ||
| url "https://github.com/git-mastery/cli/releases/download/${GITHUB_REF_NAME}/gitmastery" | ||
| sha256 "${{ steps.checksum.outputs.sha256 }}" | ||
| version "${GITHUB_REF_NAME#v}" | ||
| def install | ||
| chmod 0755, "gitmastery" | ||
| bin.install "gitmastery" | ||
| end | ||
| test do | ||
| system "#{bin}/gitmastery", "--help" | ||
| end | ||
| end | ||
| EOF | ||
| git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/git-mastery/homebrew-gitmastery.git | ||
| git remote -v | ||
| git add gitmastery.rb | ||
| git commit -m "Update to ${GITHUB_REF_NAME}" | ||
| git push origin main | ||