From 65a08babec17994b10fb6cac51f5bd2988d84b55 Mon Sep 17 00:00:00 2001 From: Uruk Date: Mon, 9 Oct 2023 15:46:50 +0200 Subject: [PATCH] Added queries in codeql, change version on ts-build, add docker-build ``` --- .github/workflows/codeql-analysis.yml | 3 +- .github/workflows/docker-build | 84 +++++++++++++++++++++++++++ .github/workflows/ts-build.yml | 8 +-- 3 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docker-build diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dff5c90..083a74d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: [ 'javascript-typescript' ] # 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 @@ -46,6 +46,7 @@ jobs: uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} + queries: +security-and-quality # 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. diff --git a/.github/workflows/docker-build b/.github/workflows/docker-build new file mode 100644 index 0000000..7cb638c --- /dev/null +++ b/.github/workflows/docker-build @@ -0,0 +1,84 @@ +name: "Docker Build" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: Test Build + runs-on: ubuntu-latest + container: node:20-alpine + steps: + - name: Checkout + uses: actions/checkout@v4 + # Install npm 10 & TypeScript + - name: Install global packages + run: npm i -g npm@10 typescript + # Install ass dependencies (including types) + - name: Install dependencies + run: npm i --save-dev + # Compile the TypeScript files + - name: Run build script + run: npm run build + + build_and_push: + name: Build & Publish Docker Images + if: github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip ci]') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + build-args: | + COMMIT_TAG=${{ github.sha }} + tags: | + tycrek/ass:master + + discord: + name: Send Discord Notification + needs: build_and_push + if: always() && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]') + runs-on: ubuntu-latest + steps: + - name: Get Build Job Status + uses: technote-space/workflow-conclusion-action@v3 + - name: Combine Job Status + id: status + run: | + failures=(neutral, skipped, timed_out, action_required) + if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then + echo "status=failure" >> $GITHUB_OUTPUT + else + echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT + fi + - name: Post Status to Discord + uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ secrets.DISCORD_WEBHOOK }} + status: ${{ steps.status.outputs.status }} + title: ${{ github.workflow }} + nofail: true diff --git a/.github/workflows/ts-build.yml b/.github/workflows/ts-build.yml index 18fea88..fa88cb2 100644 --- a/.github/workflows/ts-build.yml +++ b/.github/workflows/ts-build.yml @@ -13,15 +13,15 @@ jobs: # Checkout repo - uses: actions/checkout@v4 - # Set up Node 16 + # Set up Node 20 - name: Setup Node.js environment uses: actions/setup-node@v3 with: - node-version: 16.14.0 + node-version: 20 - # Install npm 8 & TypeScript + # Install npm 10 & TypeScript - name: Install global packages - run: npm i -g npm@8 typescript + run: npm i -g npm@10 typescript # Install ass dependencies (including types) - name: Install dependencies