Build & Release Stable #224
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 & Release Stable | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Chatterino tag to pull' | |
| default: 'v2.5.4' | |
| required: true | |
| type: string | |
| schedule: | |
| - cron: '0 0 * * *' | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: stable-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CHATTERINO_TAG: ${{ inputs.tag != '' && inputs.tag || 'v2.5.4' }} | |
| CHATTERINO_SKIP_DATE_GEN: 1 | |
| CC: clang | |
| CXX: clang++ | |
| jobs: | |
| build-stable-arch-linux: | |
| # needs: ["test-arch"] | |
| name: "Build Stable Arch Linux" | |
| runs-on: ubuntu-latest | |
| container: archlinux:base-devel | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| pacman -Sy | |
| pacman -Su --noconfirm | |
| pacman -S --noconfirm 'qt6-base' 'qt6-tools' 'boost-libs' 'openssl' 'qt6-imageformats' 'qtkeychain-qt6' 'qt6-5compat' 'qt6-svg' 'libnotify' | |
| pacman -S --noconfirm 'git' 'boost' 'cmake' 'ninja' 'clang' 'namcap' | |
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: Chatterino/chatterino2 | |
| ref: ${{ env.CHATTERINO_TAG }} | |
| path: chatterino | |
| - name: Prepare | |
| run: | | |
| echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV | |
| working-directory: chatterino | |
| - name: Build | |
| run: | | |
| chmod -R 777 /__w/pkg/pkg/arch-linux/stable | |
| sudo -unobody --preserve-env makepkg | |
| namcap PKGBUILD | |
| namcap chatterino-stable-1-1-x86_64.pkg.tar.zst | |
| working-directory: arch-linux/stable | |
| - name: Package | |
| run: | | |
| tar xvf chatterino-stable-1-1-x86_64.pkg.tar.zst | |
| mkdir dist | |
| cp chatterino-stable-1-1-x86_64.pkg.tar.zst dist/chatterino-arch-linux-x86_64.tar.zst | |
| cp ./usr/bin/chatterino dist/chatterino-arch-linux-x86_64 | |
| cp ./usr/share/applications/com.chatterino.chatterino.desktop dist/ | |
| cp ./usr/share/pixmaps/com.chatterino.chatterino.png dist/icon.png | |
| cp ./usr/share/licenses/chatterino/LICENSE dist/ | |
| working-directory: arch-linux/stable | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: arch-linux | |
| path: arch-linux/stable/dist/ | |
| release: | |
| needs: ["build-stable-arch-linux"] | |
| name: "Release Stable" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Prepare | |
| run: | | |
| echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | |
| echo "NOW_TAG=$(date +'%Y%m%dT%H%M%S')" >> $GITHUB_ENV | |
| mkdir prev-release | |
| mkdir release-artifacts | |
| - uses: actions/download-artifact@v4 | |
| name: Arch Linux | |
| with: | |
| name: arch-linux | |
| path: release-artifacts/ | |
| - name: sha256sum release artifacts | |
| run: | | |
| sha256sum * > sha256-checksums.txt | |
| working-directory: release-artifacts | |
| - id: prevrelease | |
| uses: pajlada/github-action-get-latest-release@3565c30169a63b650084b700a3b9127877a15d48 | |
| continue-on-error: true | |
| with: | |
| owner: Chatterino | |
| repo: pkg | |
| excludes: prerelease, draft | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| title: 'Stable' | |
| asset: 'chatterino-arch-linux-x86_64' | |
| - uses: dsaltares/fetch-gh-release-asset@master | |
| continue-on-error: true | |
| with: | |
| repo: 'Chatterino/pkg' | |
| version: ${{ steps.prevrelease.outputs.id }} | |
| file: "chatterino-arch-linux-x86_64" | |
| target: 'prev-release/chatterino-arch-linux-x86_64' | |
| - name: Compare | |
| id: compare | |
| run: | | |
| if ! 1>/dev/null diff -q release-artifacts/chatterino-arch-linux-x86_64 prev-release/chatterino-arch-linux-x86_64; then | |
| echo "Arch Linux file differs" | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create release | |
| if: steps.compare.outputs.has_changes == 'true' && ((github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main') | |
| uses: ncipollo/release-action@v1.16.0 | |
| with: | |
| replacesArtifacts: true | |
| allowUpdates: false | |
| artifactErrorsFailBuild: true | |
| artifacts: "release-artifacts/*" | |
| body: "body" | |
| prerelease: false | |
| name: "Stable release ${{ env.NOW }}" | |
| tag: "stable-${{ env.NOW_TAG }}" |