Merge branch 'upstream-desktop' #62
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: 'CI / Linux' | |
| on: | |
| push: | |
| branches: | |
| - development | |
| - linux | |
| - 'linux-release-*' | |
| tags: | |
| - 'release-*.*.*-linux*' | |
| - 'release-*.*.*-test*' | |
| - 'v*.*.*' | |
| pull_request: | |
| branches: | |
| - linux | |
| - linux-vnext | |
| - 'linux-release-*' | |
| jobs: | |
| arm64: | |
| name: Ubuntu arm64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ inputs.repository || github.repository }} | |
| ref: ${{ inputs.ref }} | |
| submodules: recursive | |
| - name: Package and test application in container | |
| uses: shiftkey/desktop-ubuntu-arm64-packaging@9be09c4b945873e6509baaf690d457aae08cf901 | |
| - name: Upload output artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ubuntu-arm64-artifacts | |
| path: | | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/*.rpm | |
| dist/*.sha256 | |
| retention-days: 5 | |
| if-no-files-found: error | |
| arm: | |
| name: Ubuntu arm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ inputs.repository || github.repository }} | |
| ref: ${{ inputs.ref }} | |
| submodules: recursive | |
| - name: Package and test application in container | |
| uses: shiftkey/desktop-ubuntu-arm-packaging@dd75ebc57f69fdb9319ab2b0fe11b253bb1ff2a4 | |
| - name: Upload output artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ubuntu-arm-artifacts | |
| path: | | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/*.rpm | |
| dist/*.sha256 | |
| retention-days: 5 | |
| if-no-files-found: error | |
| amd64: | |
| name: Ubuntu x64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ inputs.repository || github.repository }} | |
| ref: ${{ inputs.ref }} | |
| submodules: recursive | |
| - name: Package and test application in container | |
| uses: pol-rivero/desktop-ubuntu-amd64-packaging@07d9c4edb3b2ff3ce85201a71d683c9cc5b57a6d | |
| - name: Upload output artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ubuntu-amd64-artifacts | |
| path: | | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/*.rpm | |
| dist/*.sha256 | |
| retention-days: 5 | |
| if-no-files-found: error | |
| release_github: | |
| name: Create GitHub release | |
| needs: [arm64, arm, amd64] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 20.17.0 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.17.0 | |
| cache: yarn | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: './artifacts' | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| working-directory: './artifacts' | |
| - name: Get tag name without prefix | |
| run: | | |
| RELEASE_TAG=${GITHUB_REF/refs\/tags\//} | |
| echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV | |
| if [[ "${RELEASE_TAG}" == release-* ]]; then | |
| tagNameWithoutPrefix="${RELEASE_TAG:8}" | |
| else | |
| tagNameWithoutPrefix="${RELEASE_TAG}" | |
| fi | |
| echo "RELEASE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV | |
| # Export for downstream jobs | |
| echo "${tagNameWithoutPrefix}" > release_tag_without_prefix.txt | |
| # GitHubDesktop-linux-<arch>-<old_version>.<ext> -> GitHubDesktopPlus-<release_tag>-linux-<arch>.<ext> | |
| # GitHubDesktop-linux-<arch>-<old_version>-beta1.<ext> -> GitHubDesktopPlus-<release_tag>-linux-<arch>.<ext> | |
| - name: Rename artifacts | |
| run: | | |
| for file in $(find ./artifacts -type f -name "GitHubDesktop-linux-*"); do | |
| new_name=$(echo "$file" | sed -E "s/GitHubDesktop-linux-(.*)-[0-9]+\\.[0-9]+\\.[0-9]+(-beta[0-9]+)?\\.(.*)/GitHubDesktopPlus-${{ env.RELEASE_TAG }}-linux-\\1.\\3/") | |
| new_name=$(echo $new_name | sed -E "s/linux-amd64/linux-x86_64/") | |
| new_name=$(echo $new_name | sed -E "s/linux-aarch64/linux-arm64/") | |
| mv --verbose "$file" "$new_name" | |
| done | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: GitHub Desktop Plus ${{ env.RELEASE_TAG_WITHOUT_PREFIX }} | |
| files: | | |
| artifacts/**/*.AppImage | |
| artifacts/**/*.deb | |
| artifacts/**/*.rpm | |
| draft: false | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload RELEASE_TAG_WITHOUT_PREFIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release_tag_without_prefix | |
| path: release_tag_without_prefix.txt | |
| retention-days: 1 | |
| if-no-files-found: error | |
| release_aur: | |
| name: Publish AUR package | |
| needs: release_github | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: './artifacts' | |
| - name: Download RELEASE_TAG_WITHOUT_PREFIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release_tag_without_prefix | |
| path: './' | |
| - name: Set RELEASE_TAG_WITHOUT_PREFIX env var | |
| run: | | |
| echo "RELEASE_TAG_WITHOUT_PREFIX=$(cat ./release_tag_without_prefix.txt)" >> $GITHUB_ENV | |
| - name: Rename artifacts | |
| run: | | |
| for file in $(find ./artifacts -type f -name "GitHubDesktop-linux-*"); do | |
| new_name=$(echo "$file" | sed -E "s/GitHubDesktop-linux-(.*)-[0-9]+\\.[0-9]+\\.[0-9]+(-beta[0-9]+)?\\.(.*)/GitHubDesktopPlus-${{ env.RELEASE_TAG_WITHOUT_PREFIX }}-linux-\\1.\\3/") | |
| new_name=$(echo $new_name | sed -E "s/linux-amd64/linux-x86_64/") | |
| new_name=$(echo $new_name | sed -E "s/linux-aarch64/linux-arm64/") | |
| mv --verbose "$file" "$new_name" | |
| done | |
| - name: Prepare PKGBUILD | |
| run: | | |
| AUR_DIR=./publish/aur | |
| PKGBUILD_FILE=$AUR_DIR/PKGBUILD | |
| echo "AUR_DIR=$AUR_DIR" >> $GITHUB_ENV | |
| echo "PKGBUILD_FILE=$PKGBUILD_FILE" >> $GITHUB_ENV | |
| if [[ ! -f "$PKGBUILD_FILE" ]]; then | |
| echo "$PKGBUILD_FILE does not exist. Contents of current directory:" | |
| ls -la | |
| exit 1 | |
| fi | |
| version_without_v=$(echo "${{ env.RELEASE_TAG_WITHOUT_PREFIX }}" | sed -E "s/v(.*)/\\1/") | |
| sed -i "s/\[\[VERSION_WITHOUT_V\]\]/$version_without_v/" $PKGBUILD_FILE | |
| desktop_file_sha256=$(sha256sum $AUR_DIR/github-desktop-plus.desktop | awk '{ print $1 }') | |
| sed -i "s/\[\[DESKTOP_FILE_SHA256\]\]/$desktop_file_sha256/" $PKGBUILD_FILE | |
| x86_64_sha256=$(sha256sum artifacts/**/*-x86_64.deb | awk '{ print $1 }') | |
| sed -i "s/\[\[X86_64_SHA256\]\]/$x86_64_sha256/" $PKGBUILD_FILE | |
| aarch64_sha256=$(sha256sum artifacts/**/*-arm64.deb | awk '{ print $1 }') | |
| sed -i "s/\[\[AARCH64_SHA256\]\]/$aarch64_sha256/" $PKGBUILD_FILE | |
| armv7h_sha256=$(sha256sum artifacts/**/*-armhf.deb | awk '{ print $1 }') | |
| sed -i "s/\[\[ARMV7H_SHA256\]\]/$armv7h_sha256/" $PKGBUILD_FILE | |
| - name: Upload PKGBUILD | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PKGBUILD | |
| path: ${{ env.PKGBUILD_FILE }} | |
| retention-days: 5 | |
| if-no-files-found: error | |
| - name: Publish AUR package | |
| uses: KSXGitHub/[email protected] | |
| with: | |
| pkgname: github-desktop-plus-bin | |
| pkgbuild: ${{ env.PKGBUILD_FILE }} | |
| assets: | | |
| ${{ env.AUR_DIR }}/.gitignore | |
| ${{ env.AUR_DIR }}/github-desktop-plus.desktop | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: | |
| 'Update AUR package to version ${{ env.RELEASE_TAG_WITHOUT_PREFIX }}' | |
| ssh_keyscan_types: rsa,ecdsa,ed25519 | |
| release_rpm: | |
| name: Publish RPM package | |
| needs: release_github | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: './artifacts' | |
| - name: Download RELEASE_TAG_WITHOUT_PREFIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release_tag_without_prefix | |
| path: './' | |
| - name: Set RELEASE_TAG_WITHOUT_PREFIX env var | |
| run: | |
| echo "RELEASE_TAG_WITHOUT_PREFIX=$(cat | |
| ./release_tag_without_prefix.txt)" >> $GITHUB_ENV | |
| - name: Install createrepo_c | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y createrepo-c | |
| - name: Prepare RPM repository | |
| run: | | |
| cd ./publish/rpm | |
| rm -rf Packages repodata | |
| mkdir -p Packages | |
| find ../../artifacts -type f -name "*.rpm" -exec cp {} Packages/ \; | |
| createrepo_c --update . | |
| - name: Set up Node.js (for Firebase CLI) | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18.x' | |
| - name: Install Firebase CLI | |
| run: npm install -g firebase-tools | |
| - name: Create service account key | |
| working-directory: ./publish/rpm | |
| run: | | |
| echo '${{ secrets.RPM_FIREBASE_SERVICE_ACCOUNT }}' > /tmp/firebase-service-account.json | |
| - name: Deploy RPM repo to Firebase Hosting | |
| working-directory: ./publish/rpm | |
| env: | |
| GOOGLE_APPLICATION_CREDENTIALS: /tmp/firebase-service-account.json | |
| run: firebase deploy --only hosting | |
| release_deb: | |
| name: Publish DEB package | |
| needs: release_github | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: './artifacts' | |
| - name: Download RELEASE_TAG_WITHOUT_PREFIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release_tag_without_prefix | |
| path: './' | |
| - name: Set RELEASE_TAG_WITHOUT_PREFIX env var | |
| run: | | |
| echo "RELEASE_TAG_WITHOUT_PREFIX=$(cat ./release_tag_without_prefix.txt)" >> $GITHUB_ENV | |
| - name: Rename artifacts | |
| run: | | |
| for file in $(find ./artifacts -type f -name "GitHubDesktop-linux-*"); do | |
| new_name=$(echo "$file" | sed -E "s/GitHubDesktop-linux-(.*)-[0-9]+\\.[0-9]+\\.[0-9]+(-beta[0-9]+)?\\.(.*)/GitHubDesktopPlus-${{ env.RELEASE_TAG_WITHOUT_PREFIX }}-linux-\\1.\\3/") | |
| new_name=$(echo $new_name | sed -E "s/linux-aarch64/linux-arm64/") | |
| mv --verbose "$file" "$new_name" | |
| done | |
| - name: Install Debian repo tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y dpkg-dev apt-utils | |
| - name: Prepare APT repository | |
| run: | | |
| cd ./publish/deb | |
| rm -rf pool dists | |
| mkdir -p pool/main \ | |
| dists/stable/main/binary-amd64 \ | |
| dists/stable/main/binary-arm64 \ | |
| dists/stable/main/binary-armhf | |
| # Copy .deb packages into pool | |
| find ../../artifacts -type f -name "*.deb" -exec cp {} pool/main/ \; | |
| # Generate the Packages index for each architecture | |
| for arch in amd64 arm64 armhf; do | |
| mkdir -p dists/stable/main/binary-$arch | |
| # Only include .deb files for this arch in the Packages file | |
| find pool/main -type f -name "*-${arch}.deb" -print0 | \ | |
| xargs -0 dpkg-scanpackages . /dev/null | \ | |
| awk -v arch=$arch '$0 ~ ("Architecture: " arch) || $0 !~ /^Architecture:/ { print }' \ | |
| > dists/stable/main/binary-$arch/Packages | |
| gzip -kf dists/stable/main/binary-$arch/Packages | |
| done | |
| # Create the Release file | |
| apt-ftparchive -o APT::FTPArchive::Release::Codename=stable release dists/stable > dists/stable/Release | |
| - name: Set up Node.js (for Firebase CLI) | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18.x' | |
| - name: Install Firebase CLI | |
| run: npm install -g firebase-tools | |
| - name: Create service account key | |
| working-directory: ./publish/deb | |
| run: | | |
| echo '${{ secrets.DEB_FIREBASE_SERVICE_ACCOUNT }}' > /tmp/firebase-service-account.json | |
| - name: Deploy DEB repo to Firebase Hosting | |
| working-directory: ./publish/deb | |
| env: | |
| GOOGLE_APPLICATION_CREDENTIALS: /tmp/firebase-service-account.json | |
| run: firebase deploy --only hosting |