diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-05-12 21:08:17 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-05-12 21:08:17 +0200 |
| commit | 54a586d295e3069447dfd47e97948a71a791a456 (patch) | |
| tree | 87cef491fa063827902b88d660e1deb00483ac33 | |
| parent | 43955dc3cf4988411ed65ac20043f02233ae5876 (diff) | |
| download | boobbot-54a586d295e3069447dfd47e97948a71a791a456.tar.gz boobbot-54a586d295e3069447dfd47e97948a71a791a456.tar.bz2 boobbot-54a586d295e3069447dfd47e97948a71a791a456.zip | |
add deploy
| -rw-r--r-- | .editorconfig | 4 | ||||
| -rw-r--r-- | .github/workflows/build.yml | 62 | ||||
| -rw-r--r-- | .gitignore | 2 | ||||
| -rwxr-xr-x | create-deploy.sh | 24 | ||||
| -rw-r--r-- | systemd/boobbot.service | 4 |
5 files changed, 93 insertions, 3 deletions
diff --git a/.editorconfig b/.editorconfig index bf4651d..ef8350c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,3 +4,7 @@ indent_style = tab charset = utf-8 end_of_line = lf insert_final_newline = true + +[*.{yaml,yml}] +indent_style = space +indent_size = 4 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d110954 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,62 @@ +name: Run Build +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v4.1.1 + - uses: dlang-community/setup-dlang@v2 + with: + compiler: dmd + - run: | + ./create-deploy.sh + cd dist + zip -r ../dist.zip * + - name: Upload ZIP + uses: actions/upload-artifact@v4.3.0 + with: + name: dist-zip + path: dist.zip + release: + runs-on: ubuntu-latest + needs: build + permissions: write-all + if: ${{ 'push' == github.event_name && 'master' == github.ref_name }} + concurrency: + cancel-in-progress: true + group: nightly-release + steps: + - name: Set repository context + uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: dist-zip + - name: Update release + run: | + echo Generating notes + ( + echo "Automatically generated nightly release. This release is updated on each new commit" + echo + echo Generated from commit: \`$(git rev-parse HEAD)\` + )> release-notes.md + cat release-notes.md + echo Deleting all existing nightly assets + gh release view nightly --json assets \ + | jq '.assets[]|.name' -r \ + | while IFS= read -r name; + do + gh release delete-asset -y -- nightly "$name"; + done + echo Pushing current commit to nightly ref + git tag -f nightly + git push -f origin nightly + echo Upload release + gh release upload nightly -- "$(echo *.zip)" + gh release edit nightly -F release-notes.md + env: + GH_TOKEN: ${{ github.token }} @@ -15,4 +15,4 @@ boobbot-test-* *.obj *.lst .env - +dist diff --git a/create-deploy.sh b/create-deploy.sh new file mode 100755 index 0000000..5c5057e --- /dev/null +++ b/create-deploy.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +rm -fr dist +dub build -b release +install -Dm755 boobbot -t dist/bin +mkdir -p dist/rt +cp -r systemd dist/ + +cat >dist/install.sh <<"EOF" +#!/usr/bin/env bash +( +cd "$(dirname -- "$0")" +root="$PWD" +echo "Switched to $root" +( + cd systemd + for f in *; do + sed -e "s|SOURCE|$root|g" < "$f" > "/etc/systemd/system/$f" + done +) +) + +EOF +chmod +x dist/install.sh diff --git a/systemd/boobbot.service b/systemd/boobbot.service index 67a5584..67f36c6 100644 --- a/systemd/boobbot.service +++ b/systemd/boobbot.service @@ -6,8 +6,8 @@ Wants=boobjob.timer [Service] Type=oneshot -ExecStart=$SOURCE/boobbot -EnvironmentFile=$SOURCE/.env +ExecStart=SOURCE/bin/boobbot +EnvironmentFile=SOURCE/rt/.env [Install] WantedBy=multi-user.target |
