Docker #1810
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: Docker | |
'on': | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 2 * * *' | |
jobs: | |
Docker: | |
name: Docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v3 | |
- name: Pull base image. | |
run: docker pull quay.io/aminvakil/archlinux:latest | |
- name: Run a container of base image and mount package on it. | |
run: | | |
container_id=$(mktemp) | |
docker run --detach --privileged --cgroup-parent=docker.slice --cgroupns private --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v "${PWD}":/nvchecker quay.io/aminvakil/archlinux:latest > "${container_id}" | |
echo "container_id=$container_id" >> $GITHUB_ENV | |
- name: pacman -Syu | |
run: docker exec "$(cat ${container_id})" pacman -Syu --noconfirm | |
- name: Install nvchecker and git. | |
run: docker exec "$(cat ${container_id})" pacman -S nvchecker git pyalpm --noconfirm | |
- name: Nvcheck! | |
run: | | |
docker exec "$(cat ${container_id})" nvchecker --failures -c /nvchecker/docker.toml | |
docker_nvcmp_output=$(docker exec "$(cat ${container_id})" nvcmp -c /nvchecker/docker.toml) | |
if [[ $docker_nvcmp_output ]]; then DOCKER_HAS_CHANGED='true' ; fi | |
echo "DOCKER_HAS_CHANGED=$DOCKER_HAS_CHANGED" >> $GITHUB_ENV | |
echo 'docker_nvcmp_output<<EOF' >> $GITHUB_ENV | |
echo $docker_nvcmp_output >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
mv docker_new.txt docker_old.txt | |
# - name: Create Docker Issue. | |
# id: docker-create-issue | |
# if: env.DOCKER_HAS_CHANGED == 'true' && github.event_name != 'pull_request' | |
# uses: JasonEtco/create-an-issue@v2 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# update_existing: true | |
# filename: .github/DOCKER_ISSUE_TEMPLATE.md | |
- name: Create Docker Pull Request | |
if: env.DOCKER_HAS_CHANGED == 'true' && github.event_name != 'pull_request' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: ${{ env.docker_nvcmp_output }} | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
branch: dockerbump | |
delete-branch: true | |
title: 'Docker Bump' | |
body: ${{ env.docker_nvcmp_output }} | |
draft: false | |
- name: Stop and remove container forcefully. | |
run: docker rm -f "$(cat ${container_id})" |