Skip to content

Explicit support for building outside a git repo #65

Explicit support for building outside a git repo

Explicit support for building outside a git repo #65

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Trigger when a tag is created
create:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
strategy:
matrix:
os: [ubuntu-20.04]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Only run with create event if new tag, not new branch
if: github.event_name != 'create' || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags'))
env:
FC: gfortran
OMPI_FC: gfortran
LIBACCESSOM2_ROOT: ${{ github.workspace }}/libaccessom2
platform: ubuntu
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Determing OS version
uses: kenchan0130/actions-system-info@master
id: system-info
- name: Set OS version
run: |
echo "Release: ${{ steps.system-info.outputs.release }}"
echo "os_version=${{ steps.system-info.outputs.release }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y csh openmpi-bin libopenmpi-dev netcdf-bin libnetcdf-dev libnetcdff-dev
- name: Build libaccessom2
run: |
echo Building 1 degree
./build.sh ${platform}
- name: Debug
run: |
echo "Ref: ${{ github.ref }}"
- name: Prepare release
if: startsWith(github.ref, 'refs/tags/')
run: |
tar --transform 's,build,libaccessom2,' -zcvf binary_release_${{ env.os_version}}.tar.gz build/lib/ build/include/
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "binary_release_*.tar.gz"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}