Skip to content

Update package version #3186

Update package version

Update package version #3186

name: "Update package version"
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-latest
strategy:
matrix:
package:
- anime-game-launcher
- anime-games-launcher
- honkers-launcher
- honkers-railway-launcher
- wavey-launcher
- sleepy-launcher
steps:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Pass all secrets to next steps
run: |
while read -rd $'' line; do echo "$line" >> $GITHUB_ENV; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.key)<<EOF\n\(.value)\nEOF\u0000")[]' )
while read -r line; do echo "::add-mask::$line"; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.value)\u0000")[]' )
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Checkout repository
uses: actions/checkout@v4
- name: Create commit message
id: commit-message
run: |
./pkgs/${{matrix.package}}/update.sh --commit-message >> "${{ matrix.package }}-commit.artifact"
- name: Update package
run: ./pkgs/${{matrix.package}}/update.sh
- name: Create diff
id: diff
run: |
set -x
git diff --oneline --graph > ${{ matrix.package }}-update.diff
if [[ "$(<${{ matrix.package }}-update.diff)" == "" ]]; then
echo "skipped=yes" >> $GITHUB_OUTPUT
echo "skipped=yes" > "${{ matrix.package }}-skipped.artifact"
else
echo "skipped=no" >> $GITHUB_OUTPUT
echo "skipped=no" > "${{ matrix.package }}-skipped.artifact"
fi
- name: Upload skip artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}-skipped.artifact"
path: "${{ matrix.package }}-skipped.artifact"
- name: Upload diff artifact
if: ${{ steps.diff.outputs.skipped == 'no' }}
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}-update.diff"
path: "${{ matrix.package }}-update.diff"
- name: Upload commit artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}-commit.artifact"
path: "${{ matrix.package }}-commit.artifact"
build:
name: Build
needs: update
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cachixName:
- ezkea
nixpkgs:
- nixos-unstable
# - nixpkgs-unstable
- nixos-24.11
- pinned
package:
- anime-game-launcher
- anime-games-launcher
- honkers-railway-launcher
- honkers-launcher
- wavey-launcher
- sleepy-launcher
steps:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Pass all secrets to next steps
run: |
while read -rd $'' line; do echo "$line" >> $GITHUB_ENV; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.key)<<EOF\n\(.value)\nEOF\u0000")[]' )
while read -r line; do echo "::add-mask::$line"; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.value)\u0000")[]' )
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v30
- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: ${{ matrix.cachixName }}
authToken: '${{ env.CACHIX_AUTH_TOKEN }}'
pushFilter: '(-source$|-src$|\.tar\.gz$|\.patch$)'
- name: Download diff artifact
uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-update.diff"
path: "${{ matrix.package }}-update.diff"
- name: Check for update artifact
run: |
[[ -f "${{ matrix.package}}-update.diff/${{ matrix.package }}-update.diff" ]] || exit 1
- name: Apply diff
run: |
git apply "${{ matrix.package }}-update.diff/${{ matrix.package }}-update.diff"
- name: Build
id: build
run: |
if [[ ${{ matrix.nixpkgs }} == "pinned" ]]; then
nix build --accept-flake-config -L ".#${{ matrix.package }}"
else
nix build \
--accept-flake-config \
--print-build-logs \
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
".#${{ matrix.package }}"
fi
env:
NIXPKGS_ALLOW_UNFREE: 1
- name: Create success artifact
if: steps.build.outcome == 'success'
run: |
echo "yes" >> "${{ matrix.package }}-${{ matrix.nixpkgs }}-success.artifact"
- name: Upload success artifact
uses: actions/upload-artifact@v4
if: steps.build.outcome == 'success'
with:
name: "${{ matrix.package }}-${{ matrix.nixpkgs }}-success.artifact"
path: "${{ matrix.package }}-${{ matrix.nixpkgs }}-success.artifact"
pr:
name: Make PR
if: ${{ ! cancelled() }}
needs: [update, build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- anime-game-launcher
- anime-games-launcher
- honkers-railway-launcher
- honkers-launcher
- wavey-launcher
- sleepy-launcher
steps:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Pass all secrets to next steps
run: |
while read -rd $'' line; do echo "$line" >> $GITHUB_ENV; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.key)<<EOF\n\(.value)\nEOF\u0000")[]' )
while read -r line; do echo "::add-mask::$line"; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.value)\u0000")[]' )
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-nixos-unstable-success.artifact"
path: "${{ matrix.package }}-nixos-unstable-success.artifact"
# - uses: actions/download-artifact@v4
# with:
# name: "${{ matrix.package }}-nixpkgs-unstable-success.artifact"
# path: "${{ matrix.package }}-nixpkgs-unstable-success.artifact"
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-nixos-24.11-success.artifact"
path: "${{ matrix.package }}-nixos-24.11-success.artifact"
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-pinned-success.artifact"
path: "${{ matrix.package }}-pinned-success.artifact"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download diff artifact
uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-update.diff"
path: "${{ matrix.package }}-update.diff"
- name: Apply diff
run: |
git apply "${{ matrix.package }}-update.diff/${{ matrix.package }}-update.diff"
- name: Download commit artifact
uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-commit.artifact"
path: "${{ matrix.package }}-commit.artifact"
- run: |
echo "commit-message=$(cat ${{ matrix.package }}-commit.artifact/${{ matrix.package }}-commit.artifact)" >> $GITHUB_ENV
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: ${{ env.commit-message }}
title: ${{ env.commit-message }}
body: |
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: "update-${{ matrix.package }}"
- name: Get workflow conclusion
uses: technote-space/workflow-conclusion-action@v3.0
- name: Send notification
uses: yanzay/notify-telegram@v0.1.0
with:
chat: ${{ env.NOTIFICATION_CHAT_ID }}
token: ${{ env.NOTIFICATION_TOKEN }}
status: ${{ env.WORKFLOW_CONCLUSION }}
if: needs.update.outputs.commit-message != ''