Skip to content

Commit

Permalink
chore(release): force push
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Oct 9, 2023
1 parent 19f53a6 commit aaa5a83
Showing 1 changed file with 5 additions and 183 deletions.
188 changes: 5 additions & 183 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,200 +1,22 @@
name: Automated deploy

on:
release:
types: [ created ]
pull_request:
branches:
- '**'

env:
VERSION: ${{ github.event.release.tag_name }}
TARGET_REF: ${{ github.event.release.target_commitish }}
VERSION: 'v10.3.1'
TAG: 'latest'

jobs:
install-deps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.TARGET_REF }}
token: ${{ secrets.GPR_TOKEN }}

- name: Install deps
uses: ./.github/workflows/composite/npm

build:
runs-on: ubuntu-latest
needs: install-deps
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.TARGET_REF }}
token: ${{ secrets.GPR_TOKEN }}

- name: Install deps
uses: ./.github/workflows/composite/npm

- name: Build package
run: npm run build

- name: Pack artifacts
run: npm pack

- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./brightsec-cli-*
tag: ${{ github.ref }}
file_glob: true

- uses: actions/upload-artifact@v3
with:
name: build
path: |
dist
Dockerfile
package.json
package-lock.json
README.md
LICENSE
tools
generate-binary:
needs: build
strategy:
matrix:
include:
- os: windows-2022
target: win
node: 18
- os: macos-latest
target: macos
node: 18
# Using the `ubuntu-18.04` runner instead of latest (i.e. `ubuntu-22.04`)
# because G++/GCC 4.8 is not in an official repository yet.
- os: ubuntu-22.04
target: linux
container: ubuntu:18.04
node: 14
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.TARGET_REF }}
token: ${{ secrets.GPR_TOKEN }}

- uses: actions/download-artifact@v3
with:
name: build

- name: Install dev-deps
if: startsWith(matrix.os, 'ubuntu')
run: |
apt-get update -yq \
&& apt-get install build-essential python python-dev python3-pip g++-4.8 gcc-4.8 -yq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
- name: Configures aliases to GCC/G++
if: startsWith(matrix.os, 'ubuntu')
run: |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-4.8
- name: Install deps
uses: ./.github/workflows/composite/npm
with:
version: ${{ matrix.node }}

- name: Build executable file
run: npm run build:pkg -- -t node${{ matrix.node }}-${{ matrix.target }}-x64

- name: Copy deps
if: startsWith(matrix.os, 'win')
run: |
Copy-Item ".\node_modules\@neuralegion\os-service\build\Release\service.node" -Destination ".\bin\service.node"
Copy-Item ".\node_modules\win-ca\lib\crypt32-ia32.node" -Destination ".\bin\crypt32-ia32.node"
Copy-Item ".\node_modules\win-ca\lib\crypt32-x64.node" -Destination ".\bin\crypt32-x64.node"
Copy-Item ".\node_modules\win-ca\lib\roots.exe" -Destination ".\bin\roots.exe"
Copy-Item ".\node_modules\raw-socket\build\Release\raw.node" -Destination ".\bin\raw.node"
- name: Install WIX
if: startsWith(matrix.os, 'win')
run: |
curl -OLS https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311.exe
.\wix311.exe /install /quiet /norestart
- name: Build MSI
if: startsWith(matrix.os, 'win')
run: .\tools\msi\build.ps1
shell: pwsh
continue-on-error: true

- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ startsWith(matrix.os, 'win') && '.\bin\cli.exe' || './bin/cli' }}
asset_name: ${{ format('bright-cli-{0}-x64{1}', matrix.target, startsWith(matrix.os, 'win') && '.exe' || '') }}
tag: ${{ github.ref }}

- uses: svenstaro/upload-release-action@v2
if: startsWith(matrix.os, 'win')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: .\bin\bright-cli.msi
asset_name: bright-cli.msi
tag: ${{ github.ref }}

publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.TARGET_REF }}
token: ${{ secrets.GPR_TOKEN }}

- uses: actions/download-artifact@v3
with:
name: build

- name: Setup node
uses: ./.github/workflows/composite/npm

- name: Set TAG based on target_commitish
run: |
if [ "${{ github.event.release.target_commitish }}" == "next" ]; then
echo "TAG=next" >> $GITHUB_ENV
elif [ "${{ github.event.release.target_commitish }}" == "alpha" ]; then
echo "TAG=alpha" >> $GITHUB_ENV
elif [ "${{ github.event.release.target_commitish }}" == "master" ]; then
echo "TAG=latest" >> $GITHUB_ENV
else
exit 1
fi
- run: npm publish --tag $TAG
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# The scope does not align with the package name
# FIXME: once GitHub organization name has been changed, we should prevent this behavior
- name: Prepare GPR package
run: npm pkg set name='@neuralegion/bright-cli'

- name: Setup node
uses: ./.github/workflows/composite/npm
with:
registry: 'https://npm.pkg.github.com'
scope: '@NeuraLegion'

- run: npm publish --tag $TAG
env:
NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}

- run: sleep 30

- name: Prepare Image Tags
run: |
echo "TAG_REPEATER=brightsec/cli" >> $GITHUB_ENV
Expand Down

0 comments on commit aaa5a83

Please sign in to comment.