Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/follow-redirects-1.15.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Razon authored Jan 22, 2024
2 parents 77d57a1 + 2131c61 commit 4633590
Show file tree
Hide file tree
Showing 61 changed files with 2,038 additions and 2,133 deletions.
121 changes: 75 additions & 46 deletions .github/workflows/gh-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,99 @@ on:

jobs:
build-binaries:
runs-on: macos-latest
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
id-token: write
strategy:
matrix:
arch: [x64,arm64]
platform: [linux,macos,win]
exclude:
- platform: win
arch: arm64
env:
TARBALL_TARGETS: linux-x64,linux-arm64,darwin-x64,darwin-arm64,win32-x64

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: depot/setup-action@v1
with:
oidc: true

- name: Build using Docker (with depot)
run: mkdir preevy-bin && depot build --project ${{ vars.DEPOT_PROJECT_ID }} --build-arg CLI_TARGET=${{ matrix.platform }}-${{ matrix.arch }} -f Dockerfile.cli --target=cli --output=type=tar,dest=./preevy-bin/preevy-${{ matrix.platform }}-${{ matrix.arch }}.tar --progress=plain --platform=linux/${{ matrix.arch == 'x64' && 'amd64' || matrix.arch }} .
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: us-west-2

- uses: apple-actions/import-codesign-certs@v2
if: ${{ matrix.platform == 'macos' }}
- uses: actions/setup-node@v4
with:
p12-file-base64: ${{ secrets.APPLE_CERT_DATA }}
p12-password: ${{ secrets.APPLE_CERT_PASS }}
node-version: '18.x'
cache: yarn

- run: yarn

- run: yarn build

- name: Sign mac binaries
if: ${{ matrix.platform == 'macos' }}
env:
CERT_CN: ${{ vars.APPLE_CERT_CN }}
- name: Find packaged node version
id: find_packaged_node_version
working-directory: packages/cli
run: |
tar -xf ./preevy-bin/preevy-${{ matrix.platform }}-${{ matrix.arch }}.tar
codesign --remove-signature ./preevy
security find-identity -v
codesign --verbose=4 --sign "$CERT_CN" ./preevy
tar -cf ./preevy-bin/preevy-${{ matrix.platform }}-${{ matrix.arch }}.tar ./preevy
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: preevy-bin-${{ matrix.platform }}-${{ matrix.arch }}
path: ./preevy-bin/**
echo "NODE_VERSION=$(jq -r .oclif.update.node.version package.json)" >> "${GITHUB_OUTPUT}"
release:
runs-on: ubuntu-latest
needs: build-binaries
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: depot/setup-action@v1
- name: Download artifacts
uses: actions/download-artifact@v4
- uses: actions/cache@v3
id: cache-oclif-pack
name: Setup cache for oclif pack
with:
pattern: preevy-bin-*
path: ./preevy-bin
merge-multiple: true
path: packages/cli/tmp/cache
key: preevy-oclif-pack-node-v${{ steps.find_packaged_node_version.outputs.NODE_VERSION }}

- name: Pack tarballs
working-directory: packages/cli
run: yarn oclif pack tarballs --parallel --no-xz --targets $TARBALL_TARGETS

- name: Upload tarballs
working-directory: packages/cli
run: yarn oclif upload tarballs --no-xz --targets $TARBALL_TARGETS

- name: Rename tarballs to remove git sha
if: startsWith(github.ref, 'refs/tags/')
working-directory: packages/cli/dist
run: |
git_sha="$(git rev-parse --short HEAD)"
for f in $(find . -maxdepth 1 -type f -name 'preevy-v*'); do
new_name="$(echo ${f} | sed 's/-'"${git_sha}"'//')"
echo "Renaming ${f} to ${new_name}"
mv "${f}" "${new_name}"
done
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
draft: ${{ !startsWith(github.ref, 'refs/tags/') }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
files: |
./preevy-bin/**
packages/cli/dist/preevy-v*.tar.gz
- uses: actions/create-github-app-token@v1
if: startsWith(github.ref, 'refs/tags/')
id: app-token
with:
app-id: ${{ secrets.PREEVY_AUTOMATION_APP_ID }}
private-key: ${{ secrets.PREEVY_AUTOMATION_PRIVATE_KEY }}
owner: livecycle
repositories: 'preevy,homebrew-preevy'

- uses: actions/checkout@v4
name: Checkout homebrew repo
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ steps.app-token.outputs.token }}
repository: livecycle/homebrew-preevy
path: homebrew

- name: Update Homebrew formula
if: startsWith(github.ref, 'refs/tags/')
working-directory: packages/cli
run: |
version="$(jq -r .version package.json)"
node scripts/homebrew.mjs > ../../homebrew/Formula/preevy.rb
cd ../../homebrew
git config user.name "GitHub Actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/preevy.rb
git commit -m "Update Preevy formula for version ${version}"
git push
31 changes: 0 additions & 31 deletions Dockerfile.cli

This file was deleted.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.0.59"
"version": "0.0.60"
}
4 changes: 2 additions & 2 deletions packages/cli-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@preevy/cli-common",
"version": "0.0.59",
"version": "0.0.60",
"description": "Common library for the Preevy CLI and plugins",
"type": "module",
"main": "dist/index.js",
Expand All @@ -13,7 +13,7 @@
"license": "Apache-2.0",
"dependencies": {
"@oclif/core": "^3.15.1",
"@preevy/core": "0.0.59",
"@preevy/core": "0.0.60",
"chalk": "^4.1.2",
"iter-tools-es": "^7.5.3",
"lodash-es": "^4.17.21"
Expand Down
21 changes: 16 additions & 5 deletions packages/cli-common/src/commands/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
LogLevel, Logger, logLevels, ComposeModel, ProcessError, telemetryEmitter,
} from '@preevy/core'
import { asyncReduce } from 'iter-tools-es'
import { ParsingToken } from '@oclif/core/lib/interfaces/parser.js'
import { ArgOutput, FlagOutput, Input, ParserOutput, ParsingToken } from '@oclif/core/lib/interfaces/parser.js'
import { mergeWith } from 'lodash-es'
import { commandLogger } from '../lib/log.js'
import { composeFlags, pluginFlags } from '../lib/common-flags/index.js'
import { PreevyConfig } from '../../../core/src/config.js'
Expand Down Expand Up @@ -90,17 +91,27 @@ abstract class BaseCommand<T extends typeof Command=typeof Command> extends Comm
return result
}

public async init(): Promise<void> {
await super.init()
const { args, flags, raw } = await this.parse({
protected async reparse<
F extends FlagOutput,
B extends FlagOutput,
A extends ArgOutput>(
options?: Input<F, B, A>,
argv?: string[],
): Promise<ParserOutput<F, B, A>> {
return await this.parse(mergeWith({
flags: this.ctor.flags,
baseFlags: {
...this.ctor.baseFlags,
...this.ctor.enableJsonFlag ? jsonFlags : {},
},
args: this.ctor.args,
strict: false,
})
}, options, argv))
}

public async init(): Promise<void> {
await super.init()
const { args, flags, raw } = await this.reparse()
this.args = args as Args<T>
this.flags = flags as Flags<T>
if (this.flags.debug) {
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/dist
node_modules
node_modules
/scripts
/tmp
22 changes: 0 additions & 22 deletions packages/cli/.github/dependabot.yml

This file was deleted.

10 changes: 0 additions & 10 deletions packages/cli/.github/workflows/automerge.yml

This file was deleted.

43 changes: 0 additions & 43 deletions packages/cli/.github/workflows/failureNotifications.yml

This file was deleted.

36 changes: 0 additions & 36 deletions packages/cli/.github/workflows/manualRelease.yml

This file was deleted.

23 changes: 0 additions & 23 deletions packages/cli/.github/workflows/notify-slack-on-pr-open.yml

This file was deleted.

Loading

0 comments on commit 4633590

Please sign in to comment.