Skip to content

spaces

spaces #60

name: DGGRID GitHub Actions CI
on:
push:
branches: [master,win-math,dev,develop,'patch-','feature-']
pull_request:
branches: [master]
jobs:
tests:
name: DGGRID Earthly build
runs-on: ubuntu-latest
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- uses: actions/checkout@v2
- name: what version is installed?
run: earthly --version
- name: Login to Github Docker Registry (id not PULL)
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: run the Earthly +test target
run: earthly +test
- name: Push image (if not PULL)
if: ${{ github.event_name != 'pull_request' }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/dggrid
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
# docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
# docker push $IMAGE_ID:$VERSION
earthly --push +docker-github --imagetag=$IMAGE_ID:$VERSION