chore: tools-2529 align version format with other Aerospike tools (#20) #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mac Artifact | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_call: | |
inputs: | |
submodule: | |
description: The directory of the submodule, if this workflow is being called on a submodule | |
required: false | |
type: string | |
jobs: | |
build: | |
runs-on: macos-11 | |
steps: | |
- name: Get checkout directory | |
uses: haya14busa/action-cond@v1 | |
id: checkout-dir | |
with: | |
cond: ${{ inputs.submodule != '' }} | |
if_true: aerospike-tools # In this case we are expecting to checkout the tools package. | |
if_false: asconfig | |
- name: Get asconfig working directory | |
uses: haya14busa/action-cond@v1 | |
id: working-dir | |
with: | |
cond: ${{ inputs.submodule != '' }} | |
if_true: aerospike-tools/${{ inputs.submodule }} # In this case we are expecting to checkout the tools package. | |
if_false: asconfig | |
- uses: actions/checkout@v3 | |
with: | |
path: ${{ steps.checkout-dir.outputs.value }} | |
fetch-depth: 0 | |
- name: Checkout asconfig | |
run: | | |
# Workaround to replace ssh with http in .gitmodules and add auth | |
# If the .gitmodules was http then we would just need to add the "token:" | |
# param to the above actions/checkout@v3 step since the token is persisted. | |
git config --file .gitmodules --get-regexp url | while read url; do | |
git config --file=.gitmodules $(echo "$url" | sed -E "s/[email protected]:|https:\/\/github.com\//https:\/\/${{ secrets.TOOLS_BUILD_PAT }}:${{ secrets.TOOLS_BUILD_PAT }}@github.com\//") | |
done | |
git submodule update --init --recursive -- ${{ inputs.submodule || '.' }} | |
working-directory: ${{ steps.checkout-dir.outputs.value }} | |
- name: Print and get version | |
working-directory: ${{ steps.working-dir.outputs.value }} | |
id: tag | |
run: | | |
git describe --tags --always | |
echo "tag=$(git describe --tags --always)" >> $GITHUB_OUTPUT | |
- name: Get go version from go.mod | |
working-directory: ${{ steps.working-dir.outputs.value }} | |
run: | | |
echo "GO_VERSION=$(grep '^go ' go.mod | cut -d " " -f 2)" >> $GITHUB_ENV | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
cache: true | |
cache-dependency-path: ${{ steps.working-dir.outputs.value }}/go.sum | |
- uses: kenchan0130/actions-system-info@master | |
id: system-info | |
- name: Cache asconfig | |
uses: actions/cache@v3 | |
id: cache-asconfig | |
env: | |
cache-name: cache-asconfig | |
cache-index: "1" | |
with: | |
path: | | |
${{ steps.working-dir.outputs.value }}/bin/asconfig | |
key: ${{ env.cache-name }}-${{ env.cache-index }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.system-info.outputs.release }}-${{ steps.tag.outputs.tag }} | |
- name: Build mac asconfig | |
if: steps.cache-asconfig.outputs.cache-hit != 'true' | |
working-directory: ${{ steps.working-dir.outputs.value }} | |
run: | | |
make | |
- name: Sanity Test asconfig | |
working-directory: ${{ steps.working-dir.outputs.value }} | |
run: | | |
sudo make install | |
asconfig --version 2>&1 | grep "asconfig" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.system-info.outputs.platform }}-${{ runner.arch }}-${{ runner.os }}-${{ steps.system-info.outputs.release }}-asconfig | |
path: ${{ steps.working-dir.outputs.value }}/bin/asconfig | |
if-no-files-found: error |