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: Push images to dockerhub and ghcr.io | |
on: | |
push: | |
branches: | |
- "img_uploader" | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 4 * * 6' | |
jobs: | |
build_and_upload_images_to_hub: | |
name: Push images to dockerhub and github | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
websrv: ['apache2', 'nginx'] | |
dbhandler: ['wsgi', 'django'] | |
steps: | |
# - name: "Get current version" | |
# uses: oprypin/find-latest-tag@v1 | |
# with: | |
# repository: ${{ github.repository }} # The repository to scan. | |
# releases-only: true # We know that all relevant tags have a GitHub release for them. | |
# id: acme2certifier_ver # The step ID to refer to later. | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: "Retrieve Version from version.py" | |
run: | | |
echo APP_NAME=$(echo ${{ github.repository }} | awk -F / '{print $2}') >> $GITHUB_ENV | |
echo TAG_NAME=$(cat acme_srv/version.py | grep -i __version__ | head -n 1 | sed 's/__version__ = //g' | sed s/\'//g) >> $GITHUB_ENV | |
echo BUILD_NAME=${{ matrix.websrv }}-${{ matrix.dbhandler }} >> $GITHUB_ENV | |
- run: echo "APP tag is ${{ env.APP_NAME }}" | |
- run: echo "Latest tag is ${{ env.TAG_NAME }}" | |
- run: echo "BUILD_NAME is ${{ env.BUILD_NAME}}" | |
- name: "Retrieve Version from version.py" | |
run: | | |
VERSION=$(echo ${{ env.TAG_NAME }} | awk -F. '{print $2}') | |
PRE_VERSION=$(($VERSION - 1)) | |
echo $PRE_VERSION | |
for row in $(curl https://api.github.com/repos/grindsa/acme2certifier/tags | jq .[].name); | |
do | |
if [[ $row =~ $PRE_VERSION ]]; then | |
echo OLD_TAG_NAME=$(echo $row | sed s/\"//g) >> $GITHUB_ENV | |
echo $row | |
break | |
fi | |
done | |
- run: echo "old tag is ${{ env.OLD_TAG_NAME }}" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.OLD_TAG_NAME }} | |
- name: "Retrieve Version from version.py" | |
run: | | |
cat acme_srv/version.py | |
ls -la examples/ca_handler/*.py | |