mirror of
https://github.com/sern-handler/automata
synced 2026-06-06 01:16:51 +00:00
feat: deployments and stuff
This commit is contained in:
54
.github/workflows/docker.yml
vendored
Normal file
54
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# GitHub recommends pinning actions to a commit SHA.
|
||||
# To get a newer version, you will need to update the SHA.
|
||||
# You can also reference a tag or branch, but the action may change without warning.
|
||||
|
||||
name: Publish Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to Sr Izan's container registry
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
with:
|
||||
registry: containers.srizan.dev
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
||||
with:
|
||||
images: containers.srizan.dev/vinci
|
||||
tags: latest
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Emit a webhook to the server
|
||||
env:
|
||||
AUTH_HEADER: ${{ secrets.WHSERVER_TOKEN }}
|
||||
run: |
|
||||
curl -X POST \
|
||||
-H "Authorization: Bearer $AUTH_HEADER" \
|
||||
https://webhooks.srizan.dev/hooks/automata
|
||||
8
index.ts
8
index.ts
@@ -3,7 +3,7 @@ import bodyParser from 'body-parser';
|
||||
import 'dotenv/config';
|
||||
import { execa } from 'execa';
|
||||
import { validateJsonWebhook } from './util/validateJsonWebhook.js';
|
||||
import babashkaScripts from './babashka/scripts.json' assert { type: 'json' }
|
||||
import babashkaScripts from './babashka/scripts.json' assert { type: 'json' };
|
||||
|
||||
const app = express()
|
||||
app.use(bodyParser.json())
|
||||
@@ -28,10 +28,10 @@ app.post('/wh/updateDocsJson', async (req, res) => {
|
||||
error: 'Token valid, but ignoring action...'
|
||||
})
|
||||
}
|
||||
const command = await execa('bash', ['scripts/updateDocsJson.sh', process.env.GHTOKEN!], { shell: true })
|
||||
execa('bash', ['scripts/updateDocsJson.sh', process.env.GHTOKEN!, process.env.EMAIL!], { shell: true })
|
||||
res.send({
|
||||
success: command.exitCode === 0 ? true : false,
|
||||
cmdoutput: command.stdout
|
||||
success: true,
|
||||
message: "command is running"
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd repos/sern-community
|
||||
git checkout -b docsjson
|
||||
git pull
|
||||
# merge all changes from main to docsjson to be updated
|
||||
git checkout docsjson
|
||||
git merge main
|
||||
git -c user.name="sern bot" -c user.email="$2" commit -m "chore: merge changes from main"
|
||||
git push https://sernbot:$1@github.com/sern-handler/sern-community.git
|
||||
|
||||
cd ..
|
||||
cd website
|
||||
npm run typedoc-json
|
||||
cd ..
|
||||
cd sern-community
|
||||
git add .
|
||||
git commit -m "chore: update typedoc"
|
||||
git -c user.name="sern bot" -c user.email="$2" commit -m "chore: update typedoc"
|
||||
git push https://sernbot:$1@github.com/sern-handler/sern-community.git
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $1"\
|
||||
-H "Authorization: Bearer $1" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/sern-handler/sern-community/pulls \
|
||||
-d '{"title":"chore: update typedoc","body":"automated typedoc update (as of the new latest update in the handler)","head":"docsjson","base":"main"}'
|
||||
-d '{"title":"chore: update typedoc","body":"automated typedoc update (as of the new latest update in the handler)","head":"docsjson","base":"main"}'
|
||||
git checkout main
|
||||
@@ -44,15 +44,15 @@ npm i > /dev/null 2>&1
|
||||
cd ..
|
||||
echo " done"
|
||||
# handler
|
||||
echo -ne "- handler"
|
||||
echo -ne "- handler (using yarn)"
|
||||
cd sernHandlerV2
|
||||
npm i > /dev/null 2>&1
|
||||
yarn > /dev/null 2>&1
|
||||
cd ..
|
||||
echo " done"
|
||||
# discord bot
|
||||
echo -ne "- discord bot (using yarn)"
|
||||
cd sern-community
|
||||
yarn install > /dev/null 2>&1
|
||||
yarn > /dev/null 2>&1
|
||||
cd ..
|
||||
echo " done"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user