From 9b8102cbdc247850c5226db4fd83aaf3cadb4d10 Mon Sep 17 00:00:00 2001 From: divlo Date: Mon, 31 May 2021 15:04:17 +0200 Subject: [PATCH] ci: only one workflow (Divlo) --- .github/workflows/Divlo.yml | 106 +++++++++++++++++++++++--- .github/workflows/codeql-analysis.yml | 28 ------- .github/workflows/release.yml | 34 --------- .releaserc.json | 8 +- 4 files changed, 104 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/Divlo.yml b/.github/workflows/Divlo.yml index 73c952c..7202abb 100644 --- a/.github/workflows/Divlo.yml +++ b/.github/workflows/Divlo.yml @@ -7,18 +7,35 @@ on: branches: [master] jobs: - ci: + analyze: + name: 'Analyze' runs-on: 'ubuntu-latest' + strategy: + fail-fast: false matrix: - node-version: [14.x] + language: ['javascript'] + steps: - uses: 'actions/checkout@v2.3.4' - - name: Use Node.js ${{ matrix.node-version }} + - name: 'Initialize CodeQL' + uses: 'github/codeql-action/init@v1' + with: + languages: ${{ matrix.language }} + + - name: 'Perform CodeQL Analysis' + uses: 'github/codeql-action/analyze@v1' + + lint: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/checkout@v2.3.4' + + - name: 'Use Node.js' uses: 'actions/setup-node@v2.1.5' with: - node-version: ${{ matrix.node-version }} + node-version: '14.x' - name: 'Cache dependencies' uses: 'actions/cache@v2.1.6' @@ -26,13 +43,84 @@ jobs: path: '.npm' key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - - run: 'npm install --global npm@7' - - run: 'npm ci --cache .npm --prefer-offline' + - name: 'Install' + run: 'npm ci --cache .npm --prefer-offline' + - run: 'npm run lint:commit -- --to "${{ github.sha }}"' - run: 'npm run lint:docker' - run: 'npm run lint:editorconfig' - run: 'npm run lint:markdown' - run: 'npm run lint:typescript' - - run: 'npm run build' - - run: 'npm run lighthouse' - - run: 'npm run test' + + build: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/checkout@v2.3.4' + + - name: 'Use Node.js' + uses: 'actions/setup-node@v2.1.5' + with: + node-version: '14.x' + + - name: 'Cache dependencies' + uses: 'actions/cache@v2.1.6' + with: + path: '.npm' + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + + - name: 'Install' + run: 'npm ci --cache .npm --prefer-offline' + + - name: 'Build' + run: 'npm run build' + + - name: 'Lighthouse' + run: 'npm run lighthouse' + + test: + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/checkout@v2.3.4' + + - name: 'Use Node.js' + uses: 'actions/setup-node@v2.1.5' + with: + node-version: '14.x' + + - name: 'Cache dependencies' + uses: 'actions/cache@v2.1.6' + with: + path: '.npm' + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + + - name: 'Install' + run: 'npm ci --cache .npm --prefer-offline' + + - name: 'Test' + run: 'npm run test' + + release: + if: github.ref == 'refs/heads/master' && github.event_name == 'push' + needs: [analyze, lint, build, test] + runs-on: 'ubuntu-latest' + steps: + - uses: 'actions/checkout@v2.3.4' + + - name: 'Use Node.js' + uses: 'actions/setup-node@v2.1.5' + with: + node-version: '14.x' + + - name: 'Cache dependencies' + uses: 'actions/cache@v2.1.6' + with: + path: '.npm' + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + + - name: 'Install' + run: 'npm ci --cache .npm --prefer-offline' + + - name: 'Release' + run: 'npm run release' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c1802d2..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: 'CodeQL' - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - analyze: - name: 'Analyze' - runs-on: 'ubuntu-latest' - - strategy: - fail-fast: false - matrix: - language: ['javascript'] - - steps: - - uses: 'actions/checkout@v2.3.4' - - - name: 'Initialize CodeQL' - uses: 'github/codeql-action/init@v1' - with: - languages: ${{ matrix.language }} - - - name: 'Perform CodeQL Analysis' - uses: 'github/codeql-action/analyze@v1' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fd5bed7..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: 'Release' - -on: - workflow_run: - workflows: [Divlo] - branches: [master] - types: - - 'completed' - -jobs: - release: - runs-on: 'ubuntu-latest' - strategy: - matrix: - node-version: [14.x] - steps: - - uses: 'actions/checkout@v2.3.4' - - - name: Use Node.js ${{ matrix.node-version }} - uses: 'actions/setup-node@v2.1.5' - with: - node-version: ${{ matrix.node-version }} - - - name: 'Cache dependencies' - uses: 'actions/cache@v2.1.6' - with: - path: '.npm' - key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - - - run: 'npm install --global npm@7' - - run: 'npm ci --cache .npm --prefer-offline' - - run: 'npm run release' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc.json b/.releaserc.json index 4a4fd06..70146fd 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,4 +1,5 @@ { + "branches": ["master"], "plugins": [ [ "@semantic-release/commit-analyzer", @@ -6,7 +7,12 @@ "preset": "conventionalcommits" } ], - "@semantic-release/release-notes-generator", + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits" + } + ], "@semantic-release/github" ] }