Merge branch 'develop' into main #5
Workflow file for this run
This file contains hidden or 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 and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers the workflow when a tag starting with 'v' is pushed | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] # build for ubuntu and mac | |
| arch: [x64, arm64] # x64 and arm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up build environment | |
| run: | | |
| if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then | |
| sudo apt-get update | |
| sudo apt-get install -y autoconf gcc make | |
| elif [ ${{ matrix.os }} == 'macos-latest' ]; then | |
| brew install autoconf gcc make | |
| fi | |
| - name: Clone Easel repository | |
| run: | | |
| git clone https://github.com/TravisWheelerLab/easel | |
| cd easel | |
| git checkout BATH | |
| cd .. | |
| - name: Run autoconf | |
| run: autoconf | |
| - name: Configure | |
| run: ./configure | |
| - name: Build | |
| run: | | |
| make | |
| mkdir -p installation/usr/local/bin | |
| cd src && make install DESTDIR=../installation | |
| - name: Extract version from github.ref | |
| id: extract_version | |
| run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/})" | |
| - name: Create tar.gz archive | |
| run: | | |
| cd installation/usr/local/bin | |
| tar -czvf ../../../BATH-${{ steps.extract_version.outputs.version }}.${{ matrix.os }}.${{ matrix.arch }}.tar.gz bathsearch bathbuild bathconvert bathfetch bathstat | |
| - name: Archive build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BATH-${{ matrix.os }}-${{ matrix.arch }} | |
| path: installation/BATH-${{ steps.extract_version.outputs.version }}.${{ matrix.os }}.${{ matrix.arch }}.tar.gz | |
| if-no-files-found: error | |
| release: | |
| needs: build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| arch: [x64, arm64] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Check if release exists | |
| id: check_release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref_name }} | |
| run: | | |
| if gh release view "$tag" --repo="$GITHUB_REPOSITORY" > /dev/null 2>&1; then | |
| echo "release_exists=true" >> $GITHUB_ENV | |
| else | |
| echo "release_exists=false" >> $GITHUB_ENV | |
| fi | |
| - name: Create release | |
| if: env.release_exists == 'false' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref_name }} | |
| run: | | |
| gh release create "$tag" \ | |
| --repo="$GITHUB_REPOSITORY" \ | |
| --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ | |
| --generate-notes | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: BATH-${{ matrix.os }}-${{ matrix.arch }} | |
| path: ./artifacts | |
| - name: List files in artifacts directory | |
| run: | | |
| echo "Listing files in ./artifacts:" | |
| ls -l ./artifacts | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: ./artifacts/BATH-${{ matrix.os }}-${{ matrix.arch }}/* | |
| tag_name: ${{ steps.extract_version.outputs.version }} | |
| name: Release ${{ steps.extract_version.outputs.version }} | |
| prerelease: false | |
| draft: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| update-releases: | |
| name: Create Asset Table #creates asset table | |
| runs-on: ubuntu-latest | |
| needs: release | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' # Specify the version of Python to use | |
| - name: Install dependencies | |
| run: python -m pip install --upgrade pip && pip install requests | |
| - name: Run Python script | |
| working-directory: ${{ github.workspace }}/${{ env.PROJECT_PATH }} # set working directory | |
| run: | | |
| python .github/workflows/update_release_table.py ${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |