Skip to content

Others

Others #1830

Workflow file for this run

---
name: Others
'on':
push:
branches:
- main
schedule:
- cron: '0 2 * * *'
jobs:
Others:
name: Others
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 jq pyalpm --noconfirm
- name: Nvcheck!
run: |
docker exec "$(cat ${container_id})" nvchecker --failures -c /nvchecker/others.toml
others_nvcmp_output=$(docker exec "$(cat ${container_id})" nvcmp -c /nvchecker/others.toml)
nvchecker_source=$(docker exec "$(cat ${container_id})" awk "/\[$(echo $others_nvcmp_output | awk '{print $1}')\]/{getline; print}" /nvchecker/others.toml | awk '{print $3}' | tr -d '"')
nvchecker_repository=$(docker exec "$(cat ${container_id})" awk "/\[$(echo $others_nvcmp_output | awk '{print $1}')\]/{getline; getline; print}" /nvchecker/others.toml | awk '{print $3}' | tr -d '"')
nvchecker_prefix=$(docker exec "$(cat ${container_id})" awk "/\[$(echo $others_nvcmp_output | awk '{print $1}')\]/{getline; getline; getline; getline; print}" /nvchecker/others.toml | awk '{print $3}' | tr -d '"')
new_version=$(echo ${others_nvcmp_output} | awk '{print $4}')
case "$nvchecker_source" in
("github")
release_url="https://github.com/${nvchecker_repository}/releases/tag/${nvchecker_prefix}${new_version}"
;;
(*)
release_url=None
;;
esac
if [[ $others_nvcmp_output ]]; then OTHERS_HAS_CHANGED='true' ; fi
echo "OTHERS_HAS_CHANGED=$OTHERS_HAS_CHANGED" >> $GITHUB_ENV
echo 'others_nvcmp_output<<EOF' >> $GITHUB_ENV
echo $others_nvcmp_output >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "release_url=${release_url}" >> $GITHUB_ENV
mv others_new.txt others_old.txt
# - name: Create Others Issue.
# id: others-create-issue
# if: env.OTHERS_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/OTHERS_ISSUE_TEMPLATE.md
- name: Create Others Pull Request
if: env.OTHERS_HAS_CHANGED == 'true' && github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: ${{ env.others_nvcmp_output }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: othersbump
delete-branch: true
title: 'Others Bump'
body: ${{ env.release_url }}
draft: false
- name: Stop and remove container forcefully.
run: docker rm -f "$(cat ${container_id})"