BDE-237 dynamic host permissions granting #137
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: CI Build | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'master' | |
- 'develop' # gitflow mainly on hosted runner | |
- '*-maintenance' | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
build: | |
permissions: | |
contents: write # This is needed for release | |
actions: write # This is needed for upload-artifact | |
runs-on: | |
- ${{ github.repository_owner != github.actor && 'ubuntu-latest' || 'self-hosted' }} | |
steps: | |
- name: Checkout Commit | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Setup pnpm | |
run: | | |
corepack enable pnpm | |
- name: Cache pnpm store | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/pnpm/store/v3 | |
key: | | |
${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Update package version for release | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\/v//') | |
pnpm version $VERSION --no-git-tag-version | |
cat <<! | tee -a $GITHUB_ENV | |
NODE_ENV=production | |
! | |
- name: Build | |
run: pnpm build:chrome | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chrome | |
path: ./dist/chrome | |
- name: Zip artifact | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
VERSION: ${{ github.ref_name }} | |
run: | | |
cd ./dist/chrome | |
zip -r ../BrowserDeveloperExtension-Chrome-$VERSION.zip . | |
- name: Create Release and Upload Asset | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ./dist/BrowserDeveloperExtension-Chrome-*.zip | |
draft: true | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |