forked from Gerschtli/nix-config
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
205 changed files
with
6,135 additions
and
8,441 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*.age binary diff=age | ||
# Convert to LF line endings on checkout. | ||
*.sh text eol=lf | ||
*.nix text eol=lf |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,31 @@ | ||
name: Update inputs | ||
name: update-flake-lock | ||
on: | ||
workflow_dispatch: | ||
workflow_dispatch: # allows manual triggering | ||
pull_request: # triggers on every Pull Request | ||
schedule: | ||
- cron: 0 0 * * 1 | ||
- cron: '0 0 * * 1' | ||
|
||
jobs: | ||
update: | ||
lockfile: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
branch: ${{ steps.branch.outputs.branch }} | ||
update_available: ${{ steps.changes.outputs.update_available }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
uses: actions/checkout@v2 | ||
- name: Install nix | ||
uses: cachix/install-nix-action@v20 | ||
|
||
- name: Set branch name output | ||
id: branch | ||
run: echo "branch=ci/automatic-update-$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | ||
|
||
- name: Create branch locally | ||
run: git switch -c ${{ steps.branch.outputs.branch }} | ||
|
||
- name: Setup git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Tobias Happ" | ||
- name: Update inputs | ||
run: | | ||
nix \ | ||
--option commit-lockfile-summary 'flake.inputs: automatic update' \ | ||
flake update \ | ||
--commit-lock-file | ||
- name: Check for changes | ||
id: changes | ||
run: | | ||
if git diff --exit-code origin/master...; then | ||
echo "update_available=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "update_available=true" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Push changes | ||
if: steps.changes.outputs.update_available == 'true' | ||
run: git push --force origin ${{ steps.branch.outputs.branch }} | ||
|
||
build: | ||
uses: ./.github/workflows/ci.yml | ||
needs: update | ||
if: needs.update.outputs.update_available == 'true' | ||
with: | ||
branch: ${{ needs.update.outputs.branch }} | ||
secrets: | ||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- update | ||
- build | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: cachix/install-nix-action@v22 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check if update branch is behind master | ||
run: git diff origin/${{ needs.update.outputs.branch }}...origin/master --exit-code | ||
|
||
- name: Merge update into master | ||
run: git merge origin/${{ needs.update.outputs.branch }} | ||
|
||
- name: Push master | ||
run: git push origin master | ||
|
||
- name: Delete update branch | ||
run: git push --delete origin ${{ needs.update.outputs.branch }} | ||
|
||
# needed for cachix agent deployments | ||
final-build: | ||
uses: ./.github/workflows/ci.yml | ||
needs: merge | ||
secrets: | ||
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN }} | ||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
extra_nix_config: | | ||
show-trace = true | ||
experimental-features = nix-command flakes | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- name: Update flake.lock | ||
id: update | ||
if: ${{ github.event_name != 'pull_request' }} | ||
uses: DeterminateSystems/update-flake-lock@v19 | ||
with: | ||
pr-title: "Update flake.lock" # Title of PR to be created | ||
pr-labels: | # Labels to be set on the PR | ||
dependencies | ||
automated | ||
- name: Print PR number | ||
run: echo Pull request number is ${{ steps.update.outputs.pull-request-number }}. |
Oops, something went wrong.