summary refs log tree commit diff
path: root/api/.github
diff options
context:
space:
mode:
Diffstat (limited to 'api/.github')
-rw-r--r--api/.github/FUNDING.yml1
-rw-r--r--api/.github/ISSUE_TEMPLATE/-feature--.md20
-rw-r--r--api/.github/workflows/codeql-analysis.yml71
-rw-r--r--api/.github/workflows/docker-publish.yml47
-rw-r--r--api/.github/workflows/release.yml88
5 files changed, 227 insertions, 0 deletions
diff --git a/api/.github/FUNDING.yml b/api/.github/FUNDING.yml
new file mode 100644
index 00000000..f76b9015
--- /dev/null
+++ b/api/.github/FUNDING.yml
@@ -0,0 +1 @@
+open_collective: fosscord
\ No newline at end of file
diff --git a/api/.github/ISSUE_TEMPLATE/-feature--.md b/api/.github/ISSUE_TEMPLATE/-feature--.md
new file mode 100644
index 00000000..cefcf6b6
--- /dev/null
+++ b/api/.github/ISSUE_TEMPLATE/-feature--.md
@@ -0,0 +1,20 @@
+---
+name: "[Feature] "
+about: Suggest an idea for this project
+title: ''
+labels: enhancement
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/api/.github/workflows/codeql-analysis.yml b/api/.github/workflows/codeql-analysis.yml
new file mode 100644
index 00000000..3a3a8e92
--- /dev/null
+++ b/api/.github/workflows/codeql-analysis.yml
@@ -0,0 +1,71 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    # The branches below must be a subset of the branches above
+    branches: [ master ]
+  schedule:
+    - cron: '25 10 * * 5'
+
+jobs:
+  analyze:
+    name: Analyze
+    runs-on: ubuntu-latest
+    permissions:
+      actions: read
+      contents: read
+      security-events: write
+
+    strategy:
+      fail-fast: false
+      matrix:
+        language: [ 'javascript' ]
+        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
+        # Learn more:
+        # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
+
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v2
+
+    # Initializes the CodeQL tools for scanning.
+    - name: Initialize CodeQL
+      uses: github/codeql-action/init@v1
+      with:
+        languages: ${{ matrix.language }}
+        # If you wish to specify custom queries, you can do so here or in a config file.
+        # By default, queries listed here will override any specified in a config file.
+        # Prefix the list here with "+" to use these queries and those in the config file.
+        # queries: ./path/to/local/query, your-org/your-repo/queries@main
+
+    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
+    # If this step fails, then you should remove it and run the build manually (see below)
+    - name: Autobuild
+      uses: github/codeql-action/autobuild@v1
+
+    # ℹī¸ Command-line programs to run using the OS shell.
+    # 📚 https://git.io/JvXDl
+
+    # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines
+    #    and modify them (or add more) to build your code if your project
+    #    uses a compiled language
+
+    #- run: |
+    #   make bootstrap
+    #   make release
+
+    - name: Perform CodeQL Analysis
+      uses: github/codeql-action/analyze@v1
diff --git a/api/.github/workflows/docker-publish.yml b/api/.github/workflows/docker-publish.yml
new file mode 100644
index 00000000..46d9d04d
--- /dev/null
+++ b/api/.github/workflows/docker-publish.yml
@@ -0,0 +1,47 @@
+name: docker-publish
+
+on:
+  push:
+    branches:
+      - 'master'
+
+jobs:
+  docker:
+    runs-on: ubuntu-latest
+    steps:
+      -
+        name: Checkout
+        uses: actions/checkout@v2
+      -
+        name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+      -
+        name: Cache Docker layers
+        uses: actions/cache@v2
+        with:
+          path: /tmp/.buildx-cache
+          key: ${{ runner.os }}-buildx-${{ github.sha }}
+          restore-keys: |
+            ${{ runner.os }}-buildx-
+      -
+        name: Login to DockerHub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      -
+        name: Build and push
+        uses: docker/build-push-action@v2
+        with:
+          context: .
+          push: true
+          tags: ${{ secrets.DOCKERHUB_TAGS }}
+          cache-from: type=local,src=/tmp/.buildx-cache
+          cache-to: type=local,dest=/tmp/.buildx-cache-new
+      -
+        # Hackfix to cleanup cache; replace after buildx 0.6 and BuildKit 0.9 are released
+        # https://github.com/docker/build-push-action/pull/406#issuecomment-879184394
+        name: Move cache fix
+        run: |
+          rm -rf /tmp/.buildx-cache
+          mv /tmp/.buildx-cache-new /tmp/.buildx-cache
diff --git a/api/.github/workflows/release.yml b/api/.github/workflows/release.yml
new file mode 100644
index 00000000..3ef40aeb
--- /dev/null
+++ b/api/.github/workflows/release.yml
@@ -0,0 +1,88 @@
+on:
+  workflow_dispatch:
+  push:
+    # Sequence of patterns matched against refs/tags
+    tags:
+      - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
+
+name: Publish Release
+
+jobs:
+  insiders-build:
+    strategy:
+      matrix:
+        os: [windows, macos, ubuntu]
+        include:
+          - os: windows
+            build: npm run bundle:windows
+            artifact: fosscord-api-windows.exe
+          - os: macos
+            build: npm run bundle:macos
+            artifact: fosscord-api-macos.app.tgz
+          - os: ubuntu
+            build: npm run bundle:linux
+            artifact: fosscord-api-linux.tgz
+    runs-on: ${{ matrix.os }}-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-node@v2
+        with:
+          node-version: 14
+      - run: npm install
+      - run: npm run build
+      - run: ${{ matrix.build }}
+      - uses: actions/upload-artifact@v2
+        with:
+          name: ${{ matrix.artifact }}
+          path: ${{ matrix.artifact }}
+
+  release:
+    needs: [insiders-build]
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Extract version
+        id: extract_version
+        uses: Saionaro/extract-package-version@v1.0.6
+      - uses: actions/download-artifact@v2
+        with:
+          name: fosscord-api-windows-${{ github.sha }}.exe
+      - uses: actions/download-artifact@v2
+        with:
+          name: fosscord-api-macos-${{ github.sha }}.app.tgz
+      - uses: actions/download-artifact@v2
+        with:
+          name: fosscord-api-linux-${{ github.sha }}.tgz
+      - uses: actions/create-release@v1
+        id: create-release
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          tag_name: v${{ steps.extract_version.outputs.version }}
+          release_name: Release ${{ steps.extract_version.outputs.version }}
+          draft: false
+          prerelease: true # TODO: change this to false
+      - uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          upload_url: ${{ steps.create-release.outputs.upload_url }}
+          asset_path: fosscord-api-windows-${{ github.sha }}.exe
+          asset_name: fosscord-api-windows.exe
+          asset_content_type: application/vnd.microsoft.portable-executable
+      - uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          upload_url: ${{ steps.create-release.outputs.upload_url }}
+          asset_path: fosscord-api-macos-${{ github.sha }}.app.tgz
+          asset_name: fosscord-api-macos.app.tgz
+          asset_content_type: application/gzip
+      - uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          upload_url: ${{ steps.create-release.outputs.upload_url }}
+          asset_path: fosscord-api-linux-${{ github.sha }}.tgz
+          asset_name: fosscord-api-linux.tgz
+          asset_content_type: application/gzip