dzgui-nix/.github/workflows/update.yml

42 lines
1.5 KiB
YAML
Raw Normal View History

2024-07-05 15:18:13 -03:00
name: update
2024-07-05 14:44:12 -03:00
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Install jq
run: nix profile install nixpkgs#jq
- name: Get current version
id: current-version
run: nix-instantiate --eval --json -A dzgui.version | jq -r '"version=\"\(.)\""' >> $GITHUB_OUTPUT
- name: Run update script
run: ./package/update.sh
- name: Get new version
id: new-version
run: nix-instantiate --eval --json -A dzgui.version | jq -r '"version=\"\(.)\""' >> $GITHUB_OUTPUT
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
- name: Build new package
run: nix build -L
- name: Create Pull Request
if: ${{ steps.current-version.outputs.version != steps.new-version.outputs.version }}
uses: peter-evans/create-pull-request@v5
with:
2024-07-05 15:18:13 -03:00
base: main
2024-07-05 14:44:12 -03:00
add-paths: ./package/
commit-message: update ${{ steps.current-version.outputs.version }} -> ${{ steps.new-version.outputs.version }}
title: '[Automated] Update dzgui ${{ steps.new-version.outputs.version }}'
body: 'Automated changes by GitHub Actions'
branch: automated-update
delete-branch: true