mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
artifacts and stuff
This commit is contained in:
5
.github/scripts/load-version.ps1
vendored
Normal file
5
.github/scripts/load-version.ps1
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
$rootPath = $env:GITHUB_WORKSPACE;
|
||||||
|
$packageVersion = (Get-Content -Raw -Path $rootPath\src\package.json | ConvertFrom-Json).version;
|
||||||
|
|
||||||
|
Write-Output "Setting package version to $packageVersion";
|
||||||
|
Write-Output "::set-env name=PACKAGE_VERSION::$packageVersion";
|
||||||
8
.github/scripts/macos/clean-safari.ps1
vendored
8
.github/scripts/macos/clean-safari.ps1
vendored
@@ -1,8 +0,0 @@
|
|||||||
$rootPath = $env:GITHUB_WORKSPACE;
|
|
||||||
$distDir = $rootPath + "\dist";
|
|
||||||
$distSafariDir = $distDir + "\safari";
|
|
||||||
|
|
||||||
if (Test-Path -Path $distSafariDir) {
|
|
||||||
Remove-Item -Recurse -Force $distSafariDir
|
|
||||||
}
|
|
||||||
New-Item $distSafariDir -ItemType Directory -ea 0
|
|
||||||
95
.github/workflows/build.yml
vendored
95
.github/workflows/build.yml
vendored
@@ -10,13 +10,29 @@ on:
|
|||||||
- published
|
- published
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
cloc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up cloc
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install cloc
|
||||||
|
|
||||||
|
- name: Print lines of code
|
||||||
|
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-latest, macos-latest, ubuntu-latest]
|
os: [windows-latest, ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
@@ -27,7 +43,6 @@ jobs:
|
|||||||
- name: Set up environment
|
- name: Set up environment
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
npm install -g cloc
|
|
||||||
if($env:RUNNER_OS -eq "Linux") {
|
if($env:RUNNER_OS -eq "Linux") {
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm
|
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm
|
||||||
@@ -41,7 +56,6 @@ jobs:
|
|||||||
node --version
|
node --version
|
||||||
npm --version
|
npm --version
|
||||||
git --version
|
git --version
|
||||||
cloc --version
|
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -59,10 +73,6 @@ jobs:
|
|||||||
echo "::set-env name=PACKAGE_VERSION::$PACKAGE_VERSION"
|
echo "::set-env name=PACKAGE_VERSION::$PACKAGE_VERSION"
|
||||||
echo "::set-env name=PROD_DEPLOY::$PROD_DEPLOY"
|
echo "::set-env name=PROD_DEPLOY::$PROD_DEPLOY"
|
||||||
|
|
||||||
- name: Print LOC
|
|
||||||
shell: bash
|
|
||||||
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
|
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
@@ -79,9 +89,6 @@ jobs:
|
|||||||
elseif($env:RUNNER_OS -eq "Windows") {
|
elseif($env:RUNNER_OS -eq "Windows") {
|
||||||
npm run dist:win:ci
|
npm run dist:win:ci
|
||||||
}
|
}
|
||||||
elseif($env:RUNNER_OS -eq "macOS") {
|
|
||||||
npm run build
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Compile artifacts
|
- name: Compile artifacts
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -125,11 +132,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
||||||
|
|
||||||
- name: Increment version
|
|
||||||
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
|
|
||||||
run: ./.github/scripts/macos/increment-version.ps1
|
|
||||||
shell: pwsh
|
|
||||||
|
|
||||||
- name: Set up keychain
|
- name: Set up keychain
|
||||||
run: ./.github/scripts/macos/setup-keychain.ps1
|
run: ./.github/scripts/macos/setup-keychain.ps1
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
@@ -145,15 +147,24 @@ jobs:
|
|||||||
run: ./.github/scripts/macos/setup-profiles.ps1
|
run: ./.github/scripts/macos/setup-profiles.ps1
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Increment version
|
||||||
|
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
|
||||||
|
run: ./.github/scripts/macos/increment-version.ps1
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Load package version
|
||||||
|
run: ./.github/scripts/load-version.ps1
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
- name: Run linter
|
- name: Run linter
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
- name: Clean Safari directory
|
- name: Create Safari directory
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: ./.github/scripts/macos/clean-safari.ps1
|
run: New-Item ./dist/safari -ItemType Directory -ea 0
|
||||||
|
|
||||||
- name: Checkout browser extension
|
- name: Checkout browser extension
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -161,27 +172,49 @@ jobs:
|
|||||||
repository: 'bitwarden/browser'
|
repository: 'bitwarden/browser'
|
||||||
path: 'dist/safari/browser'
|
path: 'dist/safari/browser'
|
||||||
|
|
||||||
# - name: Build Safari extension for .dmg
|
- name: Build Safari extension
|
||||||
# shell: pwsh
|
|
||||||
# run: ./scripts/safari-build.ps1 -skipcheckout
|
|
||||||
|
|
||||||
# - name: Build application for .dmg
|
|
||||||
# run: npm run dist:mac
|
|
||||||
# env:
|
|
||||||
# APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
||||||
# APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build Safari extension for App Store
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: ./scripts/safari-build.ps1 -mas -skipcheckout
|
run: ./scripts/safari-build.ps1 -skipcheckout -skipoutcopy
|
||||||
|
|
||||||
- name: Build application for App Store
|
- name: Load Safari extension for .dmg
|
||||||
|
shell: pwsh
|
||||||
|
run: ./scripts/safari-build.ps1 -copyonly
|
||||||
|
|
||||||
|
- name: Build for .dmg
|
||||||
|
run: npm run dist:mac
|
||||||
|
env:
|
||||||
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
||||||
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Upload .app artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Bitwarden.app
|
||||||
|
path: ./dist/mac/Bitwarden.app
|
||||||
|
|
||||||
|
- name: Upload .dmg artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Bitwarden-${{ env.PACKAGE_VERSION }}.dmg
|
||||||
|
path: ./dist/mac/Bitwarden-${{ env.PACKAGE_VERSION }}.dmg
|
||||||
|
|
||||||
|
- name: Load Safari extension for App Store
|
||||||
|
shell: pwsh
|
||||||
|
run: ./scripts/safari-build.ps1 -mas -copyonly
|
||||||
|
|
||||||
|
- name: Build for App Store
|
||||||
run: npm run dist:mac:mas
|
run: npm run dist:mac:mas
|
||||||
env:
|
env:
|
||||||
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
||||||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||||
|
|
||||||
- name: Publish to App Store
|
- name: Upload .pkg artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Bitwarden-${{ env.PACKAGE_VERSION }}.pkg
|
||||||
|
path: ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg
|
||||||
|
|
||||||
|
- name: Deploy to App Store
|
||||||
run: npm run upload:mas
|
run: npm run upload:mas
|
||||||
env:
|
env:
|
||||||
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
[switch] $mas,
|
[switch] $mas,
|
||||||
[switch] $masdev,
|
[switch] $masdev,
|
||||||
[switch] $skipcheckout,
|
[switch] $skipcheckout,
|
||||||
[switch] $skipoutcopy
|
[switch] $skipoutcopy,
|
||||||
|
[switch] $copyonly
|
||||||
)
|
)
|
||||||
|
|
||||||
# Dependencies:
|
# Dependencies:
|
||||||
@@ -21,10 +22,27 @@ $distSafariAppexMas = $distSafariDir + "\browser\dist\Safari\mas\build\Release\s
|
|||||||
$distSafariAppexMasDev = $distSafariDir + "\browser\dist\Safari\masdev\build\Release\safari.appex";
|
$distSafariAppexMasDev = $distSafariDir + "\browser\dist\Safari\masdev\build\Release\safari.appex";
|
||||||
$pluginsAppex = $rootDir + "\PlugIns\safari.appex";
|
$pluginsAppex = $rootDir + "\PlugIns\safari.appex";
|
||||||
|
|
||||||
|
function CopyOutput {
|
||||||
|
if ($mas) {
|
||||||
|
Copy-Item -Path $distSafariAppexMas -Destination $pluginsAppex –Recurse
|
||||||
|
}
|
||||||
|
elseif ($masdev) {
|
||||||
|
Copy-Item -Path $distSafariAppexMasDev -Destination $pluginsAppex –Recurse
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Copy-Item -Path $distSafariAppexDmg -Destination $pluginsAppex –Recurse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Test-Path -Path $pluginsAppex) {
|
if (Test-Path -Path $pluginsAppex) {
|
||||||
Remove-Item -Recurse -Force $pluginsAppex
|
Remove-Item -Recurse -Force $pluginsAppex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($copyonly) {
|
||||||
|
CopyOutput
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
if(-not $skipcheckout) {
|
if(-not $skipcheckout) {
|
||||||
if (Test-Path -Path $distSafariDir) {
|
if (Test-Path -Path $distSafariDir) {
|
||||||
Remove-Item -Recurse -Force $distSafariDir
|
Remove-Item -Recurse -Force $distSafariDir
|
||||||
@@ -49,15 +67,7 @@ npm i
|
|||||||
npm run dist:safari
|
npm run dist:safari
|
||||||
|
|
||||||
if (-not $skipoutcopy) {
|
if (-not $skipoutcopy) {
|
||||||
if ($mas) {
|
CopyOutput
|
||||||
Copy-Item -Path $distSafariAppexMas -Destination $pluginsAppex –Recurse
|
|
||||||
}
|
|
||||||
elseif ($masdev) {
|
|
||||||
Copy-Item -Path $distSafariAppexMasDev -Destination $pluginsAppex –Recurse
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Copy-Item -Path $distSafariAppexDmg -Destination $pluginsAppex –Recurse
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cd $rootDir
|
cd $rootDir
|
||||||
|
|||||||
Reference in New Issue
Block a user