Skip to content

Docker Image CI

Docker Image CI #630

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y curl jq
- name: Docker login
run: docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"
- name: Git config
run: git config user.name "GitHub Actions Bot" &&
git config user.email "<>"
- name: Build the Docker image
run: export ANTLR_VERSION=`curl -s https://api.github.com/repos/antlr/antlr4/releases | jq -r '.[0].tag_name'` &&
curl -s https://api.github.com/repos/aeyno/antlr4-docker/tags | grep "\"name\":\ \"$ANTLR_VERSION\"" || (
docker build . --file Dockerfile --tag any0ne22/antlr4:$ANTLR_VERSION &&
docker image tag any0ne22/antlr4:$ANTLR_VERSION any0ne22/antlr4:$ANTLR_VERSION &&
docker image tag any0ne22/antlr4:$ANTLR_VERSION any0ne22/antlr4:latest &&
docker image push any0ne22/antlr4:latest &&
docker image push any0ne22/antlr4:$ANTLR_VERSION &&
git tag $ANTLR_VERSION &&
git push origin main --tags
)