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

ci: release assets for macos x64 and arm64 (M1) #519

Merged
merged 5 commits into from
Apr 17, 2023
Merged
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
28 changes: 14 additions & 14 deletions .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ jobs:
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update global workflows') ||
startsWith(github.event.pull_request.title, 'chore: update code of conduct') ||
startsWith(github.event.pull_request.title, 'ci: update global contribution guide') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for go projects') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update release-related workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update semantic release config file') ||
startsWith(github.event.pull_request.title, 'ci: update generic workflows') ||
startsWith(github.event.pull_request.title, 'ci: update global workflows') ||
startsWith(github.event.pull_request.title, 'chore: update code of conduct') ||
startsWith(github.event.pull_request.title, 'ci: update global contribution guide') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for go projects') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update release-related workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update semantic release config file') ||
startsWith(github.event.pull_request.title, 'ci: update generic workflows') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for docker-based projects') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- if: steps.should_run.outputs.shouldrun == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v3
- if: steps.should_run.outputs.shouldrun == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if Node.js project and has package.json
id: packagejson
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
Expand All @@ -54,7 +54,7 @@ jobs:
name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- if: steps.packagejson.outputs.exists == 'true'
Expand All @@ -64,7 +64,7 @@ jobs:
continue-on-error: true
- if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true'
name: Clear NPM cache and install deps again
run: |
run: |
npm cache clean --force
npm install --loglevel verbose
- if: steps.packagejson.outputs.exists == 'true'
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ jobs:
- os: macos-latest
npm_script: pack:macos
dist_folder: macos
extension: pkg
extension: arm64.pkg
- os: macos-latest
npm_script: pack:macos
dist_folder: macos
extension: x64.pkg
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
10 changes: 7 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ brew install asyncapi
```

#### `pkg` installation
Every release of the AsyncAPI CLI has its own macOS dedicated `pkg` file that enables you to install the CLI tool as a macOS application.
Every release of the AsyncAPI CLI has two macOS dedicated `pkg` file that enables you to install the CLI tool as a macOS application for x64 as well as arm64 architecture.
To download the latest CLI release, run this command in your terminal:
```sh
curl -OL https://github.com/asyncapi/cli/releases/latest/download/asyncapi.pkg
# For x64
curl -OL https://github.com/asyncapi/cli/releases/latest/download/asyncapi.x64.pkg

# For arm64
curl -OL https://github.com/asyncapi/cli/releases/latest/download/asyncapi.arm64.pkg
```

To download a specific CLI release, run this command in your terminal:
Expand Down Expand Up @@ -103,4 +107,4 @@ ln -s <absolute-path>/bin/asyncapi /user/local/bin/asyncapi

# The "asyncapi" command should be available to be used
asyncapi
```
```
11 changes: 6 additions & 5 deletions scripts/releasePackagesRename.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function fileExists(checkPath) {
}

async function checkAndRenameFile(generatedPath, newPath) {
if (await fileExists(generatedPath)) {
if (await fileExists(generatedPath)) {
await rename(generatedPath, newPath);
}
}
Expand Down Expand Up @@ -46,11 +46,11 @@ async function renameTar({version, name, sha}) {
await checkAndRenameFile(generatedPath, newPath);
}

async function renamePkg({version, name, sha}) {
async function renamePkg({version, name, sha, arch}) {
const dist = 'dist/macos';

const generatedPath = path.resolve(dist, `${name}-v${version}-${sha}.pkg`);
const newPath = path.resolve(dist, 'asyncapi.pkg');
const generatedPath = path.resolve(dist, `${name}-v${version}-${sha}-${arch}.pkg`);
const newPath = path.resolve(dist, `asyncapi.${arch}.pkg`);
await checkAndRenameFile(generatedPath, newPath);
}

Expand All @@ -59,7 +59,8 @@ async function renamePackages() {
const name = 'asyncapi';
const sha = await git.revparse(['--short', 'HEAD']);
await renameDeb({version: version.split('-')[0], name, sha});
await renamePkg({version, name, sha});
await renamePkg({version, name, sha, arch: 'x64'});
await renamePkg({version, name, sha, arch: 'arm64'});
await renameTar({version, name, sha});
}

Expand Down