Merge pull request #10 from joewiz/fix-readme-python3 #39
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: TEI Publisher CI and Docker Snapshots | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: teipublisher-ner | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Build docker image | |
run: docker build -t ner -f Dockerfile . | |
- name: Start docker image | |
run: docker run --publish 8001:8001 --name tp-ner -dit ner | |
- name: install bats | |
run: sudo apt-get install bats | |
- name: Run test | |
run: bats test/*.bats | |
- name: Stop Container | |
run: docker stop tp-ner | |
push: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Make buildkit default | |
uses: docker/setup-buildx-action@v2 | |
id: buildx | |
with: | |
install: true | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/eeditiones/tei-publisher-ner/teipublisher-ner | |
# TODO(DP): This could be extended further | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
- name: Push image | |
if: github.ref == 'refs/heads/master' | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
PUBLISHER_VERSION=master | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# - name: Build image | |
# run: docker build . --file Dockerfile --tag $IMAGE_NAME | |
# - name: Log into registry | |
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | |
# - name: Push image | |
# run: | | |
# IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME | |
# # 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=master | |
# echo IMAGE_ID=$IMAGE_ID | |
# echo VERSION=$VERSION | |
# docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
# docker push $IMAGE_ID:$VERSION |