Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor workflows for less duplication #228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/oclif-package-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and package OCLIF app
description: Build and package OCLIF app for Linux, Windows and/or macOS
inputs:
target:
description: What to build
required: true
default: tarballs
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install dependencies
shell: bash
run: yarn

- name: Set version in package json
shell: bash
run:
npm version ${GITHUB_REF#refs/tags/} --no-git-tag-version --no-workspaces-update

- name: Build
shell: bash
run: yarn compile

- name: Build packages for ${{ inputs.target }}
shell: bash
run: yarn package:${{ inputs.target }}
if: ${{ inputs.target != "npm" }}
92 changes: 13 additions & 79 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,10 @@ jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Build and package
uses: ./.github/actions/oclif-package-action
with:
node-version: "18"

- name: Install dependencies for Windows builds
run: sudo apt-get install -y p7zip-full nsis

- name: Install dependencies
run: yarn

- name: Set version in package json
run:
npm version ${GITHUB_REF#refs/tags/} --no-git-tag-version
--no-workspaces-update

- name: Build
run: yarn compile

- name: Build all possible packages
run: yarn package:tarballs
target: tarballs

- name: Upload to S3
run:
Expand All @@ -53,29 +34,13 @@ jobs:
build-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install dependencies for Windows builds
run: sudo apt-get install -y p7zip-full nsis

- name: Install dependencies
run: yarn

- name: Set version in package json
run:
npm version ${GITHUB_REF#refs/tags/} --no-git-tag-version
--no-workspaces-update

- name: Build
run: yarn compile

- name: Build all possible packages
run: yarn package:windows
- name: Build and package
uses: ./.github/actions/oclif-package-action
with:
target: windows

- name: Upload to S3
run: yarn oclif upload win
Expand All @@ -93,27 +58,10 @@ jobs:
build-macos:
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
- name: Build and package
uses: ./.github/actions/oclif-package-action
with:
node-version: "18"

- name: Install dependencies
run: yarn

- name: Set version in package json
run:
npm version ${GITHUB_REF#refs/tags/} --no-git-tag-version
--no-workspaces-update

- name: Build
run: yarn compile

- name: Build all possible packages
run: yarn package:macos
target: macos

- name: Upload to S3
run: yarn oclif upload macos
Expand All @@ -135,24 +83,10 @@ jobs:
- build-windows
- build-macos
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
- name: Build and package
uses: ./.github/actions/oclif-package-action
with:
node-version: "18"

- name: Install dependencies
run: yarn

- name: Set version in package json
run:
npm version ${GITHUB_REF#refs/tags/} --no-git-tag-version
--no-workspaces-update

- name: Build
run: yarn compile
target: npm

- name: Publish
run: |
Expand Down