Skip to content

Access: Rename to invite #655

Access: Rename to invite

Access: Rename to invite #655

# Github action to build and publish a Docker image
#
name: build and publish docker
on:
pull_request:
branches:
- 'master'
push:
branches:
- 'master'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Disable apparmor
run: |
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Build the docker image
run: docker build --rm -t surfnet/centos7-openconext-ga -f tests/Dockerfile.centos-7-ga .
- name: Run Ansible on the Docker container to install OpenConext
run: sh tests/githubactions-build.sh
- name: Check other issues
if: ${{ failure() }}
run: |
docker exec ansible-test-ga cat /var/log/messages
docker exec ansible-test-ga cat /var/log/manage/manage.log
docker exec systemctl status haproxy
- name: Set branch name
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Set branch name on pull_request
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | sed 's/\//_/g')" >> $GITHUB_ENV
- name: Commit and tag the Docker image
run: |
DOCKER_COMMIT_SHA=$(docker commit ansible-test-ga)
docker tag $DOCKER_COMMIT_SHA ghcr.io/openconext/openconext-deploy/openconext-core:${{ env.BRANCH_NAME }}
- name: Show the docker image
run: docker images
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_CONTAINER_REGISTRY_PAT }}
- name: Push the image
run: docker push ghcr.io/openconext/openconext-deploy/openconext-core:${{ env.BRANCH_NAME }}