bitwarden-desktop/.github/workflows/build.yml

78 lines
2.0 KiB
YAML
Raw Normal View History

2020-03-24 14:03:14 +01:00
name: Build
on: push
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
2020-03-24 15:33:49 +01:00
- name: Set up environment
2020-03-24 14:03:14 +01:00
shell: pwsh
run: |
npm install -g cloc
if($env:RUNNER_OS -eq "Linux") {
sudo apt-get update
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm
}
elseif($env:RUNNER_OS -eq "Windows") {
choco --version
}
- name: Print environment
run: |
node --version
npm --version
git --version
cloc --version
- name: Checkout repo
uses: actions/checkout@v2
2020-03-24 15:33:49 +01:00
- name: Determine deployment variables
shell: pwsh
env:
GITHUB_REF: ${{ github.ref }}
run: |
$PACKAGE_VERSION = (Get-Content -Raw -Path .\src\package.json | ConvertFrom-Json).version
$PROD_DEPLOY = "false"
2020-03-24 15:36:29 +01:00
if($env:GITHUB_REF.StartsWith("refs/tags/v")) {
echo "::set-env name=RELEASE_NAME::$env:GITHUB_REF.Replace('refs/tags/v', '')"
2020-03-24 15:33:49 +01:00
}
echo "::set-env name=PACKAGE_VERSION::$PACKAGE_VERSION"
echo "::set-env name=PROD_DEPLOY::$PROD_DEPLOY"
2020-03-24 14:03:14 +01:00
- name: Print LOC
2020-03-24 15:33:49 +01:00
shell: bash
2020-03-24 14:03:14 +01:00
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
- name: Install Node dependencies
run: npm install
- name: Run linter
run: npm run lint
- name: Dist build application
shell: pwsh
run: |
2020-03-24 15:33:49 +01:00
echo "Building dist for $env:PACKAGE_VERSION"
2020-03-24 14:03:14 +01:00
if($env:RUNNER_OS -eq "Linux") {
npm run dist:lin
}
elseif($env:RUNNER_OS -eq "Windows") {
2020-03-24 15:42:20 +01:00
npm run dist:win:ci
2020-03-24 14:03:14 +01:00
}
elseif($env:RUNNER_OS -eq "macOS") {
2020-03-24 15:33:49 +01:00
npm run build
2020-03-24 14:03:14 +01:00
}