Skip to content

Commit

Permalink
Redo github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanVaughn committed May 4, 2024
1 parent f5a2fb2 commit a45c8de
Show file tree
Hide file tree
Showing 15 changed files with 238 additions and 173 deletions.
10 changes: 0 additions & 10 deletions .dockerignore

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/test.yml

This file was deleted.

129 changes: 38 additions & 91 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ on:
description: "Space-seperated version numbers to force update of"

jobs:
getversions:
get-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

permissions:
contents: read
Expand All @@ -26,7 +24,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
python-version: "3.12"
cache: pip

- name: Install Requirements
Expand All @@ -35,101 +33,50 @@ jobs:
python -m pip install -r dev/requirements.txt
- name: Get Versions
id: set-matrix
run: echo "matrix=$(python3 dev/versionchecker.py --forced ${{ inputs.forced }})" >> $GITHUB_OUTPUT
id: script
run: python3 dev/versionchecker.py --forced ${{ inputs.forced }}
env:
GITHUB_TOKEN: ${{ github.token }}

buildversions:
needs: getversions
if: ${{ fromJSON(needs.getversions.outputs.matrix).include[0] != null }}
runs-on: ubuntu-latest
outputs:
matrixes: ${{ steps.script.outputs.matrixes }}

build-versions:
needs: get-versions
if: ${{ fromJSON(needs.get-versions.outputs.matrixes.builder).include[0] != null }}
strategy:
matrix: ${{ fromJSON(needs.getversions.outputs.matrix) }}
matrix: ${{ fromJSON(needs.get-versions.outputs.matrixes.builder) }}

permissions:
contents: write
contents: read
packages: write

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest

- name: Dockerhub Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
uses: NathanVaughn/reusable-actions/.github/workflows/docker-build-push.yml@main
with:
platform: ${{ matrix.platform }}
tags: ${{ matrix.tags }}
context: docker
buildargs: |
WEBTREES_VERSION=${{ matrix.webtrees_version }}
PHP_VERSION=${{ matrix.php_version }}
PATCH_VERSION=${{ matrix.patch_version }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

create-releases:
needs:
- get-versions
- build-versions

- name: Github CR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v5
with:
tags: ${{ matrix.images }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: type=gha
cache-to: type=gha
build-args: |
WEBTREES_VERSION=${{ matrix.webtrees_version }}
PHP_VERSION=${{ matrix.php_version }}
PATCH_VERSION=${{ matrix.patch_version }}
push: true

- name: Update DockerHub README
uses: christian-korneck/update-container-description-action@v1
env:
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_PASSWORD }}
with:
destination_container_repo: nathanvaughn/webtrees
provider: dockerhub
short_description: ${{ github.event.repository.description }}

# - name: Update Harbor README
# uses: christian-korneck/update-container-description-action@v1
# env:
# DOCKER_USER: ${{ secrets.NTHNVCR_USERNAME }}
# DOCKER_PASS: ${{ secrets.NTHNVCR_PASSWORD }}
# with:
# destination_container_repo: cr.nthnv.me/library/webtrees
# provider: harbor2

- name: Create Tag
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag : ${{ matrix.webtrees_version }}
strategy:
matrix: ${{ fromJSON(needs.get-versions.outputs.matrixes.releaser) }}

- name: Build Release Notes
id: release_notes
# https://trstringer.com/github-actions-multiline-strings/
run: |
echo "IMAGE_LIST<<EOF" >> $GITHUB_OUTPUT
python3 -c "m='${{ matrix.images }}';[print(f'- {i}') for i in m.split(',')]" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
permissions:
contents: write

- name: Create Release
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ matrix.prerelease }}
tag_name: ${{ matrix.webtrees_version }}
body: |
Automated release for webtrees version ${{ matrix.webtrees_version }}: ${{ matrix.src_url }}
Tags pushed:
${{ steps.release_notes.outputs.IMAGE_LIST }}
uses: NathanVaughn/reusable-actions/.github/workflows/create-release.yml@main
with:
tag: ${{ matrix.tag }}
body: ${{ matrix.body }}
prerelease: ${{ matrix.prerelease }}
161 changes: 159 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
.vscode
**/__pycache__/
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

Loading

0 comments on commit a45c8de

Please sign in to comment.