ci: update build.yml #373
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: autobet-build | |
on: | |
push: | |
branches-ignore: | |
- "dependabot**" | |
paths: | |
- ".github/workflows/build.yml" | |
- "autobetlib/**" | |
- "pack/**" | |
- "ui/**" | |
- "web/**" | |
- "resources/**" | |
- "package.json" | |
- "package-lock.json" | |
- "main.js" | |
- "scripts/**" | |
- "install.js" | |
- "src/**" | |
pull_request: | |
paths: | |
- ".github/workflows/build.yml" | |
- "autobetlib/**" | |
- "pack/**" | |
- "ui/**" | |
- "web/**" | |
- "resources/**" | |
- "package.json" | |
- "package-lock.json" | |
- "main.js" | |
- "scripts/**" | |
- "install.js" | |
- "src/**" | |
jobs: | |
build: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Initialize CppJsLib repo | |
run: | | |
git submodule init | |
git submodule update | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: 'cpp' | |
# Steps for getting the name for this artifact | |
# The artifact name has the followig format: | |
# autobet-${LATEST_RELEASE_TAG}-beta.YYYYmmdd-1HHMMSS | |
- name: Get latest release tag | |
id: latest_release | |
run: echo "::set-output name=release::$(node -p 'require(`./package.json`).version')" | |
shell: bash | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d.1%H%M%S')" | |
shell: bash | |
- name: Set version name | |
id: version_name | |
run: echo "::set-output name=version::autobet-${{steps.latest_release.outputs.release}}-beta.${{steps.date.outputs.date}}" | |
shell: bash | |
- name: Print version name | |
run: echo ${{steps.version_name.outputs.version}} | |
shell: bash | |
# Retrieve caches | |
- name: Cache npm | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
~\AppData\Roaming\npm-cache | |
**\node_modules | |
autobetLib\node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**\package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
# Install conan | |
- name: Get Conan | |
uses: turtlebrowser/get-conan@main | |
with: | |
version: 1.61.0 | |
# Cache conan | |
- name: Cache conan | |
uses: actions/cache@v2 | |
id: cache-conan | |
env: | |
cache-name: cache-conan-modules | |
with: | |
path: C:\Users\runneradmin\.conan | |
key: host-${{ runner.os }}-target-${{ runner.os }}-${{ hashFiles('autobetlib/conanfile.txt') }} | |
# Set the autobet package version using npm | |
- name: Set autobet version | |
run: npm version --no-git-tag-version ${{steps.latest_release.outputs.release}}-beta.${{steps.date.outputs.date}} -f | |
# Build steps | |
# Runs 'npm install' and 'npm run-script pack' | |
# To install all dependencies and package the application | |
- name: Run npm install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
- name: Package | |
run: npm run pack | |
env: | |
GH_TOKEN: ${{secrets.github_token}} | |
# Upload the artifact | |
- name: Upload beta build | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{steps.version_name.outputs.version}} | |
path: dist/autobet-v${{steps.latest_release.outputs.release}}-beta.${{steps.date.outputs.date}}.exe | |
analyze-js: | |
#name: Analyze javascript | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: 'javascript' | |
# Perform js CodeQL Analysis | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 |