Skip to content

Tag Global Stable Images #13

Tag Global Stable Images

Tag Global Stable Images #13

name: Tag Global Stable Images
on:
workflow_dispatch:
inputs:
stablePrefix:
description: 'Year-Quarter prefix of a stable tag; please ensure its appearance on Wiki homepage'
default: '2099.3'
required: true
dryRun:
type: boolean
description: 'dry-run: retrieve original image names ONLY'
required: true
jobs:
global_stable_tagging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Cleanup
run: |
docker image prune -a -f
docker container prune -f
- name: Free disk space
run: |
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm || true
echo "some directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "some packages purged"
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Install pydoit fixed
run: |
git clone https://github.com/davidzyx/doit
pip install ./doit
rm -rf ./doit
mkdir -p logs manifests
touch logs/run.log logs/.empty
- name: Set Python-specific environment variables
run: |
echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV
echo "PYTHONUNBUFFERED=TRUE" >> $GITHUB_ENV
- name: Clone Wiki
uses: actions/checkout@v3
with:
repository: ${{github.repository}}.wiki
path: wiki
- name: Setup artifacts
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
run: |
doit prep
mkdir -p logs
- name: Dry-run Tagging
if: ${{ github.event.inputs.dryRun == 'true' }}
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
run: >
doit tag
--original_tag ${{ github.event.inputs.stablePrefix }}
--dry_run
--global_stable
- name: Tag Global Stable
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
run: >
doit tag
--original_tag ${{ github.event.inputs.stablePrefix }}
--global_stable
- name: Update Wiki, Stable_Tag.md
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
run: |
doit stable
- name: Push Wiki to GitHub
if: >
(github.event.inputs.dryRun == 'false') &&
!contains(github.base_ref , 'test') &&
!contains(github.base_ref , 'dev') &&
!contains(github.event.head_commit.message , 'skip push') &&
(
github.ref == 'refs/heads/main'
)
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[ci skip] Automated publish for ${{github.sha}}'
repository: wiki/
- name: Archive artifacts and logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: tag-artifacts
path: |
artifacts
manifests