build: version not parsed correctly in homebrew release [nobuild] #29
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: Package executables CI | |
on: | |
workflow_call: | |
inputs: | |
release: | |
type: boolean | |
default: false | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Whether to make these built binaries the latest release' | |
type: boolean | |
default: false | |
jobs: | |
build: | |
name: ${{ matrix.friendlyName }} | |
strategy: | |
matrix: | |
node-version: [18.x] | |
os: [ubuntu-20.04, windows-2019, macos-latest, arm64] | |
include: | |
- os: ubuntu-20.04 | |
friendlyName: Ubuntu x64 | |
fileName: linux | |
exeName: contensis-cli-linux | |
homebrewFormula: contensis-cli-linux | |
- os: windows-2019 | |
friendlyName: Windows x64 | |
fileName: win | |
exeName: contensis-cli-win.exe | |
- os: macos-latest | |
friendlyName: macOS x64 | |
fileName: mac | |
exeName: contensis-cli-mac | |
homebrewFormula: contensis-cli | |
- os: arm64 | |
friendlyName: Linux arm64 | |
fileName: linux-arm64 | |
exeName: contensis-cli-linux-arm64 | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
env: | |
CHOCO_NUSPEC: installers/chocolatey/contensis-cli.nuspec | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'main' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install yarn | |
if: matrix.os == 'arm64' | |
run: | | |
npm install --global yarn | |
- name: Install additional dependencies | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
sudo apt-get -qq -y install gnome-keyring \ | |
libsecret-1-dev \ | |
dbus-x11 \ | |
python3-dev | |
- name: Setup os specific environment | |
run: | | |
yarn run bootstrap | |
yarn run build | |
- name: Prepare system keyring (Linux) | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
echo "Install keyring..." | |
pip3 install --upgrade pip | |
pip3 install keyring | |
echo "Prepare D-Bus session..." | |
export $(dbus-launch) | |
dbus-launch | |
gnome-keyring-daemon --start --daemonize --components=secrets | |
echo 'neil' | gnome-keyring-daemon -r -d --unlock | |
echo "Create a test key using script..." | |
python -c "import keyring;keyring.set_password('system', 'login', 'pwd');" | |
- name: Build Windows executable and get app version | |
if: matrix.os == 'windows-2019' | |
run: | | |
yarn run build:exe:win | |
cd bin | |
dir | |
.\contensis-cli --version | |
echo "APP_VERSION=$(.\contensis-cli --version)" >> $env:GITHUB_ENV | |
exit 0 | |
- name: Build Linux/macOS executable from os native sources and get app version | |
if: matrix.os != 'windows-2019' | |
run: | | |
yarn run build:exe | |
cd bin && ls -lah | |
chmod +x contensis-cli | |
echo "APP_VERSION=$(./contensis-cli --version)" >> $GITHUB_ENV | |
- name: Run some tests with executable | |
env: | |
CONTAINER_CONTEXT: 'true' | |
run: | | |
cd bin | |
./contensis-cli connect zenhub-dev -p migratortron -id ${{ secrets.CONTENSIS_CLIENT_ID }} -s ${{ secrets.CONTENSIS_SHARED_SECRET }} | |
./contensis-cli get entries | |
- name: Rename executable to include platform | |
run: ${{ matrix.os == 'windows-2019' && env.WIN || env.COMMAND }} | |
env: | |
COMMAND: mv bin/contensis-cli bin/${{ matrix.exeName }} | |
WIN: Rename-Item -Path ".\bin\contensis-cli.exe" -NewName "${{ matrix.exeName }}" | |
- name: Archive packaged artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: contensis-cli-${{ env.APP_VERSION }}-${{ matrix.fileName }} | |
path: bin/contensis-cli* | |
- name: Upload package build artifact to release assets | |
if: inputs.release | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }} | |
FILENAME: ${{ matrix.fileName == 'win' && 'win.exe' || matrix.fileName }} | |
run: gh release upload contensis-cli-v${{ env.APP_VERSION }} ./bin/contensis-cli-${{ env.FILENAME }} --clobber | |
# Handle Chocolatey version bump and release | |
- name: Make a copy of the exe for chocolatey | |
if: matrix.os == 'windows-2019' | |
run: Copy-Item -Path ".\bin\contensis-cli-win.exe" ".\installers\chocolatey" | |
- name: Set contensis-cli.nuspec version for chocolatey | |
if: matrix.os == 'windows-2019' | |
uses: Thundernerd/dotnet-project-version-updater@v1.2 | |
with: | |
file: ${{ env.CHOCO_NUSPEC }} | |
version: ${{ env.APP_VERSION }} | |
- name: Package chocolatey release | |
if: matrix.os == 'windows-2019' | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: pack ${{ env.CHOCO_NUSPEC }} --version ${{ env.APP_VERSION }} | |
- name: Set chocolatey publish key | |
if: inputs.release && matrix.os == 'windows-2019' | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: apikey --key="'${{ secrets.CHOCOLATEY_API_KEY }}'" --source="'https://push.chocolatey.org/'" | |
- name: Publish release to chocolatey | |
if: inputs.release && matrix.os == 'windows-2019' | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: push --source="'https://push.chocolatey.org/'" | |
# Handle Homebrew version bump and release | |
- uses: nflatley-zengenti/bump-homebrew-formula-action | |
if: inputs.release && matrix.homebrewFormula | |
env: | |
COMMITTER_TOKEN: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }} | |
RELEASE_TAG: contensis-cli-v${{ env.APP_VERSION }} | |
with: | |
formula-name: ${{ matrix.homebrewFormula }} | |
formula-path: Formula/${{ matrix.homebrewFormula }}.rb | |
homebrew-tap: contensis/homebrew-cli | |
tag-name: ${{ env.RELEASE_TAG }} | |
download-url: https://github.com/contensis/cli/releases/download/${{ env.RELEASE_TAG }}/${{ matrix.exeName }} | |
commit-message: | | |
{{formulaName}} {{version}} | |
Created by https://github.com/mislav/bump-homebrew-formula-action |