Skip to content

Commit

Permalink
Setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasfara committed Dec 9, 2023
1 parent d0d11e2 commit 2640893
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .chezmoi.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[data]
email = foo@bar.com
gpgkey = 0123456789ABCDEFG
[data.restic]
path = /home/foo
password = foobarfoo
repository = my-repository
b2accountid = bbaccounts
b2accountkey = bbkey
healthchecks = 1234567
encryption = "gpg"
[gpg]
symmetric = true
args = ["--batch", "--passphrase", GPG_PASSPHRASE, "--no-symkey-cache"]
31 changes: 31 additions & 0 deletions .github/workflows/dispatcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI/CD

on:
push:
branches-ignore:
- 'dependabot/**'
paths-ignore:
- 'CHANGELOG.md'
- 'LICENSE'
- 'README.md'
- 'renovate.json'
- '.gitignore'
- '.mergify.yml'
pull_request:
workflow_dispatch:

jobs:
dispatcher:
runs-on: ubuntu-latest
# For PRs execute only on commit since the branch protection require the branch to be up-to-date (optimize the workflow).
# Triggers the executions if an external PR is opened.
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.repository
|| startsWith(github.head_ref, 'refs/heads/dependabot/')
steps:
- run: 'true'
ci-cd:
needs: [ dispatcher ]
uses: ./.github/workflows/test-deployment.yml
secrets: inherit
27 changes: 27 additions & 0 deletions .github/workflows/test-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI/CD Pipeline

on:
workflow_call:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Setup container
run: pacman -Syu --noconfirm chezmoi git
- name: Copy configuration file
run: |
mkdir -p $HOME/.config/chezmoi
cp .chezmoi.toml.example $HOME/.config/chezmoi/chezmoi.toml
sed -i 's/GPG_PASSPHRASE/${{ secrets.GPG_PASSPHRASE }}/g' $HOME/.config/chezmoi/chezmoi.toml
cat $HOME/.config/chezmoi/chezmoi.toml
- name: Run chezmoi
run: |
chezmoi init ${{ github.server_url }}/${{ github.repository }}.git
chezmoi apply --verbose

0 comments on commit 2640893

Please sign in to comment.