Skip to content

Build Lens

Build Lens #454

Workflow file for this run

name: Build Lens
on:
schedule:
- cron: '20 */6 * * *'
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-20.04, macos-11]
node-version: [16.x]
runs-on: ${{ matrix.os }}
timeout-minutes: 360
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Export version to variable
id: version
run: |
echo "LENS_VERSION=$(cat version)" >> $GITHUB_OUTPUT
shell: bash
- name: Checkout Lens
uses: actions/checkout@v3
with:
repository: lensapp/lens
fetch-depth: 1
path: lens
ref: v${{ steps.version.outputs.LENS_VERSION }}
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Update Lens
run: |
node update.js
- name: Get yarn cache directory path
id: npm-cache-dir-path
shell: bash
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 3
retry_on: error
command: |
cd lens
npm run all:install
- name: Build Linux Lens
working-directory: lens
run: |
# when installing dependencies lens specifies a specific version of npm
npx npm run build:app
shell: bash
if: ${{ runner.os == 'Linux' }}
env:
ELECTRON_BUILDER_EXTRA_ARGS: "--x64 --arm64"
- name: Build macOS Lens
working-directory: lens
run: |
npx npm run build:app
shell: bash
if: ${{ runner.os == 'macOS' }}
env:
ELECTRON_BUILDER_EXTRA_ARGS: "--x64 --arm64"
- name: Build Windows Lens
working-directory: lens
run: |
npx npm run build:app
shell: bash
if: ${{ runner.os == 'Windows' }}
env:
ELECTRON_BUILDER_EXTRA_ARGS: "--x64"
CSC_LINK: ${{ secrets.WIN_CERT_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_PASS }}
- name: Calculate Window checksum
run: certutil -hashfile OpenLens-${{ steps.version.outputs.LENS_VERSION }}.exe SHA256 | tee OpenLens-${{ steps.version.outputs.LENS_VERSION }}.exe.sha256
shell: bash
if: ${{ runner.os == 'Windows' }}
working-directory: lens/open-lens/dist
- name: Calculate Linux and Mac checksum
run: for filename in OpenLens-${{ steps.version.outputs.LENS_VERSION }}*; do shasum -a 256 ${filename} | tee ${filename}.sha256 ; done
shell: bash
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
working-directory: lens/open-lens/dist
- uses: actions/upload-artifact@v3
if: github.ref != 'refs/heads/main'
with:
name: OpenLens-${{ matrix.os }}
retention-days: 5
path: |
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.dmg
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.AppImage
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.deb
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.rpm
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.zip
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}.exe
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.sha256
- name: Generate Changelog
run: curl -s https://api.github.com/repos/lensapp/lens/releases/tags/v${{ steps.version.outputs.LENS_VERSION }} | jq -r '.body' > ${{ github.workspace }}-CHANGELOG.txt
- name: Release
uses: softprops/action-gh-release@v0.1.15
if: github.ref == 'refs/heads/main'
with:
tag_name: v${{ steps.version.outputs.LENS_VERSION }}
body_path: ${{ github.workspace }}-CHANGELOG.txt
files: |
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.dmg
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.AppImage
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.deb
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.rpm
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.zip
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}.exe
lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.sha256
# Commenting out due to the need to install extensions after upgrading
# after a version. This seemed safer than publishing to the auto upgrade
# link.
#
##- name: Latest
## uses: softprops/action-gh-release@v0.1.15
## if: github.ref == 'refs/heads/main'
## with:
## tag_name: Latest
## files: |
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.dmg
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.AppImage
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.deb
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.rpm
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.zip
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}.exe
## lens/open-lens/dist/OpenLens-${{ steps.version.outputs.LENS_VERSION }}*.sha256
## lens/open-lens/dist/lates*.yml