Skip to content

Commit

Permalink
added building + release
Browse files Browse the repository at this point in the history
  • Loading branch information
pagoru committed Oct 21, 2024
1 parent eb4bd7b commit 205e618
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM debian:latest

WORKDIR /app

# Install curl and jq
RUN apt-get update \
&& apt-get install -y curl jq unzip

COPY ./downloader.sh /downloader.sh

RUN chmod 777 /downloader.sh
RUN ls -l /
CMD /downloader.sh
12 changes: 12 additions & 0 deletions .docker/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: openhotel-at
services:
web:
restart: unless-stopped
container_name: openhotel-at
ports:
- "9120:9120"
volumes:
- "openhotel-at:/app"
image: "openhotel/at:latest"
volumes:
openhotel-auth: null
6 changes: 6 additions & 0 deletions .docker/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tasks": {
"enable": "docker buildx create --use",
"build": "docker buildx build --platform linux/amd64,linux/arm64 -t openhotel/at:latest --push ."
}
}
29 changes: 29 additions & 0 deletions .docker/downloader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

FILE_NAME='at_linux'

# Detect architecture
ARCH=$(arch)
echo "arch: ($ARCH)"

if [ "$ARCH" = "aarch64" ]; then
FILE_NAME="${FILE_NAME}_${ARCH}"
fi

if [ ! -f ./$FILE_NAME ]; then
echo "Checking version..."
VERSION=$(curl -s "https://api.github.com/repos/openhotel/at/releases/latest" | jq -r '.tag_name')

echo "Downloading server (version $VERSION)..."
curl -L https://github.com/openhotel/at/releases/download/$VERSION/$FILE_NAME.zip -o $FILE_NAME.zip

echo "Server downloaded!"

echo "Decompressing server..."
unzip -o $FILE_NAME.zip
echo "Server decompressed!"

chmod 777 $FILE_NAME
fi

./$FILE_NAME
21 changes: 21 additions & 0 deletions .github/workflows/auth-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build At
on:
push:
branches: [master]
pull_request:

jobs:
auth-build:
name: "Build At"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x

- name: Build
run: deno task build
23 changes: 23 additions & 0 deletions .github/workflows/prettier-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Prettier Check
on:
push:
branches: [master]
pull_request:

jobs:
prettier:
name: "Checking code style"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 20.x

- name: Install dependencies
run: npm install

- name: Run Prettier check
run: npm run prettier:check
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish
on:
push:
tags:
- "*"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
auth-at:
name: "Build At"

runs-on: ubuntu-latest
strategy:
matrix:
os: [darwin, linux, linux_aarch64, windows]

steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x

- name: Set Versions
uses: actions/github-script@v4
id: set_version
with:
script: |
const tag = context.ref.substring(10).replace('v', '')
core.setOutput('tag', tag)
core.setOutput('version', tag.split("-")[0])
- name: Replace consts.ts version
uses: richardrigutins/replace-in-files@v2
with:
files: "./mod.ts"
search-text: "__VERSION__"
replacement-text: ${{ steps.set_version.outputs.tag }}

- name: Compile
run: deno task compile:${{ matrix.os }}

- name: "Zip build"
run: |
cd ./build/
zip -r ../auth_${{ matrix.os }}.zip .
- name: "Upload to release"
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./at_${{ matrix.os }}.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true

0 comments on commit 205e618

Please sign in to comment.