diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4edb451 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +# .github/workflows/release.yml +name: goreleaser + +on: + push: + # run only against tags + tags: + - "*" + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v4 + with: + go-version: stable + # More assembly might be required: Docker logins, GPG, etc. + # It all depends on your needs. + - uses: goreleaser/goreleaser-action@v5 + with: + # either 'goreleaser' (default) or 'goreleaser-pro': + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 3934a36..13490db 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,6 +8,7 @@ builds: - linux goarch: - amd64 + - arm64 @@ -26,7 +27,10 @@ nfpms: license: "MIT" bindir: "/opt/sortinghat" contents: - - src: systemd/sortinghat.service + - src: ./systemd/sortinghat.service dst: "/lib/systemd/system/sortinghat.service" - - src: systemd/sortinghat.timer + - src: ./systemd/sortinghat.timer dst: "/lib/systemd/system/sortinghat.timer" + - src: ./systemd/config.yml + dst: /etc/sortinghat/sortinghat.yml + type: "config|noreplace" diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..914bc60 --- /dev/null +++ b/Justfile @@ -0,0 +1,2 @@ +test-release: + goreleaser release --skip=validate --skip=publish --snapshot --clean diff --git a/README.md b/README.md index 32ea782..1b5272f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,18 @@ group to allow users on Posit Connect to RunAsCurrentUser without needing to also set up a separate unix group for them, which can be a painful approval activity in enterprise environments. +## Installation and Activation + +After installing, update either the systemd service file command to include a `--dir` flag +or update the `/etc/sortinghat/config.yml` file to include a `dir` key, +then startup the service via: + +``` +systemctl daemon-reload # Reload systemd to recognize the new timer +systemctl enable sortinghat.timer # Enable the timer to start on boot +systemctl start sortinghat.timer # Start the timer immediately +``` + ## Usage ```shell diff --git a/systemd/config.yml b/systemd/config.yml new file mode 100644 index 0000000..8d1536f --- /dev/null +++ b/systemd/config.yml @@ -0,0 +1,7 @@ +# can set the `dir` to the directory to the directory of homedirs +# can set `allowed_groups` to as an array of groups that are allowed to get +# added +# dir: /shared/user-homes +# allowed_groups: +# - usergrp1 +# - usergrp2 diff --git a/systemd/sortinghat.service b/systemd/sortinghat.service index eccee2f..3ac98d8 100644 --- a/systemd/sortinghat.service +++ b/systemd/sortinghat.service @@ -3,7 +3,7 @@ Description=Run sorting-hat [Service] Type=oneshot -ExecStart=/opt/sortinghat/sortinghat scan --dir=/shared +ExecStart=/opt/sortinghat/sortinghat scan [Install] WantedBy=multi-user.target