Attempt no 2 for release action #2
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: Build Nim macOS Executable | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
branches: | |
- development | |
jobs: | |
build: | |
runs-on: macos-latest-xlarge | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Nim | |
uses: jiro4989/setup-nim-action@v1 | |
with: | |
nim-version: "2.0.6" | |
- name: Install libfswatch | |
run: | | |
brew update | |
brew install fswatch | |
- name: Install Nim dependencies | |
run: | | |
nimble install -y | |
- name: Read version from nimble file | |
id: get_version | |
run: | | |
VERSION=$(grep 'version =' acc.nimble | awk -F '"' '{print $2}') | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Build executable | |
run: | | |
nim c -d:nimDebugDlOpen -p:src --threads:on --mm:orc --deepcopy:on -d:release src/acc.nim | |
- name: Prepare release | |
id: prepare_release | |
run: | | |
if [[ ${{ github.ref }} == refs/tags/* ]]; then | |
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT | |
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
echo "RELEASE_NAME=Release ${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT | |
echo "ASSET_NAME=acc-macos" >> $GITHUB_OUTPUT | |
else | |
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT | |
echo "TAG_NAME=v${{ steps.get_version.outputs.VERSION }}-dev" >> $GITHUB_OUTPUT | |
echo "RELEASE_NAME=Development build v${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT | |
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT | |
echo "ASSET_NAME=acc-macos-dev" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.prepare_release.outputs.TAG_NAME }} | |
release_name: ${{ steps.prepare_release.outputs.RELEASE_NAME }} | |
draft: false | |
prerelease: ${{ steps.prepare_release.outputs.IS_PRERELEASE }} | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./src/acc | |
asset_name: ${{ steps.prepare_release.outputs.ASSET_NAME }} | |
asset_content_type: application/octet-stream |