Skip to content

Commit

Permalink
switch from pkg to oclif pack
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Razon committed Jan 9, 2024
1 parent f2b1f88 commit 4abcc4d
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 255 deletions.
132 changes: 81 additions & 51 deletions .github/workflows/gh-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,100 @@ on:

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

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

- uses: aws-actions/configure-aws-credentials@v4
with:
oidc: true
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: us-west-2

- uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: yarn

- run: yarn

- 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 }} .
- run: yarn build

- uses: apple-actions/import-codesign-certs@v2
if: ${{ matrix.platform == 'macos' }}
- uses: actions/cache@v3
id: cache
with:
p12-file-base64: ${{ secrets.APPLE_CERT_DATA }}
p12-password: ${{ secrets.APPLE_CERT_PASS }}
path: packages/cli/tmp
key: preevy-oclif-pack-node18

- name: Sign mac binaries
if: ${{ matrix.platform == 'macos' }}
- name: pack and upload tarballs
working-directory: packages/cli
env:
CERT_CN: ${{ vars.APPLE_CERT_CN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGETS: linux-x64,linux-arm64,darwin-x64,darwin-arm64,win32-x64
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/**
yarn oclif pack tarballs --parallel --no-xz --targets $TARGETS
yarn oclif upload tarballs --no-xz --targets $TARGETS
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
with:
pattern: preevy-bin-*
path: ./preevy-bin
merge-multiple: true
# - uses: depot/setup-action@v1
# with:
# oidc: true

- name: Release
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/**
# - 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: apple-actions/import-codesign-certs@v2
# if: ${{ matrix.platform == 'macos' }}
# with:
# p12-file-base64: ${{ secrets.APPLE_CERT_DATA }}
# p12-password: ${{ secrets.APPLE_CERT_PASS }}

# - name: Sign mac binaries
# if: ${{ matrix.platform == 'macos' }}
# env:
# CERT_CN: ${{ vars.APPLE_CERT_CN }}
# 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/**

# 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
# with:
# pattern: preevy-bin-*
# path: ./preevy-bin
# merge-multiple: true

# - name: Release
# 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/**
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.

18 changes: 0 additions & 18 deletions packages/cli/.github/workflows/onPushToMain.yml

This file was deleted.

19 changes: 0 additions & 19 deletions packages/cli/.github/workflows/onRelease.yml

This file was deleted.

9 changes: 0 additions & 9 deletions packages/cli/.github/workflows/test.yml

This file was deleted.

17 changes: 15 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"eslint-plugin-react": "^7.32.2",
"jest": "29.7.0",
"lint-staged": "^15.2.0",
"oclif": "^4.1.0",
"oclif": "^4.1.3",
"pkg": "^5.8.1",
"shx": "^0.3.3",
"ts-node": "^10.9.1",
Expand Down Expand Up @@ -92,7 +92,20 @@
"./dist/hooks/postrun/telemetry.js"
]
},
"topicSeparator": " "
"topicSeparator": " ",
"update": {
"node": {
"version": "18.17.1",
"options": [
"--no-warnings=ExperimentalWarning"
]
},
"s3": {
"bucket": "releases.preevy.dev",
"host": "https://releases.preevy.dev",
"acl": "public-read"
}
}
},
"pkg": {
"assets": [
Expand Down
Loading

0 comments on commit 4abcc4d

Please sign in to comment.