Build & Release Nightly #363
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 Nightly | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: nightly-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CHATTERINO_SKIP_DATE_GEN: 1 | |
| CC: clang | |
| CXX: clang++ | |
| jobs: | |
| build-nightly-arch-linux: | |
| # needs: ["test-arch"] | |
| name: "Build Nightly 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-svg' 'libnotify' 'hunspell' | |
| pacman -S --noconfirm 'git' 'boost' 'cmake' 'ninja' 'clang' 'namcap' | |
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: Chatterino/chatterino2 | |
| path: chatterino | |
| fetch-depth: 0 # allows for tags access | |
| - 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/nightly | |
| sudo -unobody --preserve-env makepkg | |
| namcap PKGBUILD | |
| namcap chatterino-nightly-1-1-x86_64.pkg.tar.zst | |
| working-directory: arch-linux/nightly | |
| - name: Package | |
| run: | | |
| tar xvf chatterino-nightly-1-1-x86_64.pkg.tar.zst | |
| mkdir dist | |
| cp chatterino-nightly-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/nightly | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: arch-linux | |
| path: arch-linux/nightly/dist/ | |
| release: | |
| needs: ["build-nightly-arch-linux"] | |
| name: "Release Nightly" | |
| 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: 'Nightly' | |
| 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: "Nightly release ${{ env.NOW }}" | |
| tag: "nightly-${{ env.NOW_TAG }}" |