From 6226f0560b982b43fc87f6ac1a293cf29d0542a1 Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Sat, 2 Mar 2024 18:06:49 -0500 Subject: [PATCH] add github workflows --- .github/workflows/bun-test.yml | 14 ++++++++++++ .github/workflows/ghcr.yml | 42 ++++++++++++++++++++++++++++++++++ .github/workflows/npm.yml | 19 +++++++++++++++ Dockerfile | 4 ++++ 4 files changed, 79 insertions(+) create mode 100644 .github/workflows/bun-test.yml create mode 100644 .github/workflows/ghcr.yml create mode 100644 .github/workflows/npm.yml create mode 100644 Dockerfile diff --git a/.github/workflows/bun-test.yml b/.github/workflows/bun-test.yml new file mode 100644 index 0000000..7d5782b --- /dev/null +++ b/.github/workflows/bun-test.yml @@ -0,0 +1,14 @@ +name: Bun Test + +on: push + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - run: bun install + - run: bun run test \ No newline at end of file diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml new file mode 100644 index 0000000..660cf83 --- /dev/null +++ b/.github/workflows/ghcr.yml @@ -0,0 +1,42 @@ +name: GitHub Container Registry +on: + release: + types: [ published ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{raw}} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml new file mode 100644 index 0000000..92116f9 --- /dev/null +++ b/.github/workflows/npm.yml @@ -0,0 +1,19 @@ +name: NPM Registry +on: + release: + types: [ published ] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4472b9c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM oven/bun +COPY . . +RUN bun install +ENTRYPOINT [ "bun", "./index.ts" ] \ No newline at end of file