1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

feat: add release build action

This commit is contained in:
hiroki matsumoto 2022-12-04 18:49:55 +09:00
parent 9ba92cb072
commit ffe61f8cff
No known key found for this signature in database
GPG Key ID: E38247BFA7F03A56
20 changed files with 29 additions and 743 deletions

View File

@ -1,33 +0,0 @@
name: Add Card to Project(s)
on:
issues:
types: [opened]
pull_request_target:
types: [opened]
env:
MY_GITHUB_TOKEN: ${{ secrets.PROJECT_GITHUB_TOKEN }}
EVENT_TYPE: $GITHUB_EVENT_NAME
jobs:
add_card_to_project:
runs-on: ubuntu-latest
name: Add Card to Project(s)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Event Type
run: echo $GITHUB_EVENT_NAME
- name: Assign NEW issues to project 1
uses: ./.github/actions/add-card-to-project
if: github.event_name == 'issues' && github.event.action == 'opened'
with:
project: "https://github.com/orgs/lensapp/projects/1"
column_name: "Backlog"
card_position: "bottom"
- name: Assign NEW pull requests to project 1
uses: ./.github/actions/add-card-to-project
if: github.event_name == 'pull_request_target' && github.event.action == 'opened'
with:
project: "https://github.com/orgs/lensapp/projects/1"
column_name: "PRs"
card_position: "bottom"

View File

@ -1,35 +0,0 @@
name: Bump Version on master
on:
pull_request:
types:
- closed
branches:
- master
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') }}
steps:
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: |
npm i --location=global semver
- name: Bump version to first alpha of next minor version
run: |
NEW_VERSION=$(cat package.json | jq .version --raw-output| xargs semver -i preminor --preid alpha)
cat package.json | jq --arg new_version "$NEW_VERSION" '.version = $new_version' > new-package.json
mv new-package.json package.json
- uses: peter-evans/create-pull-request@v4
with:
add-paths: package.json
commit-message: Update package.json version to next preminor because of recent release
signoff: true
delete-branch: true
title: Update version to next preminor
labels: chore

View File

@ -1,31 +0,0 @@
name: Check Documentation
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
build:
name: Check Docs
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'area/documentation') }}
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Generate Extensions API Reference using typedocs
run: |
yarn install
yarn typedocs-extensions-api
- name: Verify that the markdown is valid
run: |
yarn run verify-docs

View File

@ -1,71 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: "41 3 * * 2"
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,28 +0,0 @@
name: Electronegativity
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- uses: doyensec/electronegativity-action@v1.1
with:
input: src/
electron-version: "19.0.4"
severity: medium
- name: Upload sarif
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ../results

View File

@ -1,28 +0,0 @@
name: Check License Header
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
css:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: "^1.18.0"
- name: Install addlicense
run: |
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/google/addlicense@v1.0.0
- name: Check license headers
run: |
set -e
export PATH=${PATH}:`go env GOPATH`/bin
addlicense -check -l mit -c "OpenLens Authors" src/**/*.?css

View File

@ -1,26 +0,0 @@
name: Lint Repo
on:
- pull_request
jobs:
build:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install deps
run: yarn install
- name: Lint
run: yarn run lint

View File

@ -1,97 +0,0 @@
name: Publish docs via GitHub Pages
on:
push:
branches:
- master
release:
types:
- published
concurrency:
group: publish-docs
cancel-in-progress: true
jobs:
verify-docs:
name: Verify docs
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Generate Extensions API Reference using typedocs
run: |
yarn install
yarn typedocs-extensions-api
- name: Verify that the markdown is valid
run: |
yarn run verify-docs
build:
name: Deploy docs
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
needs: verify-docs
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://${{ secrets.GH_TOKEN }}@github.com/lensapp/mkdocs-material-insiders.git
pip install mike
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Generate Extensions API Reference using typedocs
run: |
yarn install
yarn typedocs-extensions-api
- name: mkdocs deploy master
if: contains(github.ref, 'refs/heads/master')
run: |
mike deploy --push master
- name: Get the release version
if: contains(github.ref, 'refs/tags/v') && !github.event.release.prerelease
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: mkdocs deploy new release
if: contains(github.ref, 'refs/tags/v') && !github.event.release.prerelease
run: |
mike deploy --push --update-aliases ${{ steps.get_version.outputs.VERSION }} latest
mike set-default --push ${{ steps.get_version.outputs.VERSION }}

View File

@ -1,22 +0,0 @@
name: "Maintenance"
on:
# So that PRs touching the same files as the push are updated
push:
# So that the `dirtyLabel` is removed if conflicts are resolve
# We recommend `pull_request_target` so that github secrets are available.
# In `pull_request` we wouldn't be able to change labels of fork PRs
pull_request_target:
types: [synchronize]
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: check if prs are dirty
uses: eps1lon/actions-label-merge-conflict@releases/2.x
with:
dirtyLabel: "PR: needs rebase"
removeOnDirtyLabel: "PR: ready to ship"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request."
commentOnClean: "Conflicts have been resolved. A maintainer will review the pull request shortly."

View File

@ -1,36 +0,0 @@
name: Delete Documentation Version
on:
workflow_dispatch:
inputs:
version:
description: 'Version string to be deleted (e.g."v0.0.1")'
required: true
jobs:
build:
name: Delete docs Version
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://${{ secrets.GH_TOKEN }}@github.com/lensapp/mkdocs-material-insiders.git
pip install mike
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: mkdocs delete version
run: |
mike delete --push ${{ github.event.inputs.version }}

View File

@ -1,67 +0,0 @@
name: Manual documentation update to sync a deployed Version with Master branch
on:
workflow_dispatch:
inputs:
version:
description: 'Version string to use (e.g."v0.0.1")'
required: true
jobs:
build:
name: Manual documentation update to sync a deployed Version with Master branch
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://${{ secrets.GH_TOKEN }}@github.com/lensapp/mkdocs-material-insiders.git
pip install mike
- name: Checkout Version from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: "${{ github.event.inputs.version }}"
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Generate Extensions API Reference using typedocs
run: |
yarn install
yarn typedocs-extensions-api
- name: Checkout master branch from lens
uses: actions/checkout@v3
with:
path: "master"
ref: "master"
- name: Bring in latest mkdocs.yml from master
run: |
cp -p ./master/mkdocs.yml .
cp -p ./master/docs/stylesheets/extra.css ./docs/stylesheets/extra.css
rm -fr ./docs/clusters ./docs/contributing ./docs/faq ./docs/getting-started ./docs/helm ./docs/support ./docs/supporting
sed -i '/Protocol Handlers/d' ./mkdocs.yml
sed -i '/IPC/d' ./mkdocs.yml
sed -i 's#../../clusters/adding-clusters.md#https://docs.k8slens.dev/getting-started/add-cluster/#g' ./docs/extensions/get-started/your-first-extension.md
sed -i 's#clusters/adding-clusters.md#https://docs.k8slens.dev//getting-started/adding-clusters/#g' ./docs/README.md
sed -i 's#../../contributing/README.md#https://docs.k8slens.dev/contributing/#g' ./docs/extensions/guides/generator.md
- name: git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: mkdocs deploy new release
run: |
mike deploy --push --force ${{ github.event.inputs.version }}

View File

@ -1,36 +0,0 @@
name: Update Default Documentation Version
on:
workflow_dispatch:
inputs:
version:
description: 'Version string to be default (e.g."v0.0.1")'
required: true
jobs:
build:
name: Update default docs Version
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://${{ secrets.GH_TOKEN }}@github.com/lensapp/mkdocs-material-insiders.git
pip install mike
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: mkdocs update default version
run: |
mike set-default --push ${{ github.event.inputs.version }}

View File

@ -1,38 +0,0 @@
name: Publish NPM Package `master`
on:
push:
branches:
- master
concurrency:
group: publish-master-npm
cancel-in-progress: true
jobs:
publish:
name: Publish NPM Package `master`
runs-on: ubuntu-latest
if: |
${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }}
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout Release
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Generate NPM package
run: |
make build-npm
- name: publish new release
run: |
make publish-npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_RELEASE_TAG: master

View File

@ -1,33 +0,0 @@
name: Publish NPM Package Release
on:
release:
types:
- published
jobs:
publish:
name: Publish NPM Package Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout Release
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Generate NPM package
run: |
make build-npm
- name: publish new release
if: contains(github.ref, 'refs/tags/v')
run: |
make publish-npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

29
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Release
on:
push:
branches-ignore:
- '**'
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ macos-latest ]
runs-on: ${{ matrix.os }}
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Build Lens
run: |
env ELECTRON_BUILDER_EXTRA_ARGS="--arm64 --x64 --mac --config.dmg.sign=false" make build
ls -la dist/
shell: bash
working-directory: lens

View File

@ -1,30 +0,0 @@
name: Release Open Lens
on:
pull_request:
types:
- closed
branches:
- master
- release/v*.*
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') }}
steps:
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: butlerlogic/action-autotag@stable
id: tagger
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
tag_prefix: "v"
- uses: ncipollo/release-action@v1
if: ${{ steps.tagger.outputs.tagname != '' }}
with:
name: ${{ steps.tagger.outputs.tagname }}
commit: master
tag: ${{ steps.tagger.outputs.tagname }}
body: ${{ github.event.pull_request.body }}

View File

@ -1,14 +0,0 @@
name: Require Milestone
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
milestone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Require Milestone
run: |
exit $(gh pr view ${{ github.event.pull_request.number }} --json milestone | jq 'if .milestone == null then 1 else 0 end')
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

View File

@ -1,13 +0,0 @@
name: Require Release Category Labels
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v1
with:
mode: exactly
count: 1
labels: "enhancement, bug, chore, area/ci, area/tests, dependencies, area/documentation, skip-changelog"

View File

@ -1,14 +0,0 @@
name: Cull Stale Issues
on:
schedule:
- cron: "30 1 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
only-issue-labels: "needs-information"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# -1 here means that PRs will never be marked as stale
days-before-pr-stale: -1

View File

@ -1,91 +0,0 @@
name: Test
on:
pull_request:
branches:
- "**"
push:
branches:
- master
jobs:
test:
name: ${{ matrix.type }} tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
type: [unit, smoke]
node-version: [16.x]
steps:
- name: Checkout Release from lens
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add the current IP address, long hostname and short hostname record to /etc/hosts file
if: runner.os == 'Linux'
run: |
echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
shell: bash
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: nick-fields/retry@v2
name: Install dependencies
with:
timeout_minutes: 10
max_attempts: 3
retry_on: error
command: make node_modules
- run: make test
name: Run tests
if: ${{ matrix.type == 'unit' }}
- run: make test-extensions
name: Run In-tree Extension tests
if: ${{ matrix.type == 'unit' }}
- run: make ci-validate-dev
if: ${{ contains(github.event.pull_request.labels.*.name, 'dependencies') && matrix.type == 'unit' }}
name: Validate dev mode will work
- name: Install integration test dependencies
id: minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: latest
if: ${{ runner.os == 'Linux' && matrix.type == 'smoke' }}
- run: xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' make integration
name: Run Linux integration tests
if: ${{ runner.os == 'Linux' && matrix.type == 'smoke' }}
- run: make integration
name: Run macOS integration tests
shell: bash
env:
ELECTRON_BUILDER_EXTRA_ARGS: "--x64 --arm64"
if: ${{ runner.os == 'macOS' && matrix.type == 'smoke' }}
- run: make integration
name: Run Windows integration tests
shell: bash
env:
ELECTRON_BUILDER_EXTRA_ARGS: "--x64 --ia32"
if: ${{ runner.os == 'Windows' && matrix.type == 'smoke' }}