Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
frugan-dev committed Nov 6, 2024
0 parents commit db46060
Show file tree
Hide file tree
Showing 52 changed files with 4,821 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .auto-changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"unreleased": true,
"commitLimit": false,
"template": "auto-changelog.hbs",
"output": "CHANGELOG.md"
}
73 changes: 73 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
MARIADB_TAG=latest
MARIADB_ALLOW_EMPTY_PASSWORD=yes
MARIADB_USER=user
MARIADB_PASSWORD=
MARIADB_DATABASE=wordpress

#https://it.wordpress.org/download/releases/
#https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/
# 5.6.2 -> 22 Febbraio 2021, PHP 7.4.16, Composer 1.10.20
# 5.7.2 -> 24 Luglio 2021, PHP 7.4.21, Composer 2.1.3
# 5.8.3 -> 6 Marzo 2022, PHP 7.4.27, Composer 2.2.4
# 5.9.3 -> 6 Luglio 2022, PHP 8.0.21, Composer 2.3.10
# 6.0.3 -> 24 Aprile 2023, PHP 8.1.12, Composer 2.4.4
# 6.1.1 -> 24 Aprile 2023, PHP 8.1.17, Composer 2.5.5
# 6.2.2 -> 7 Agosto 2023, PHP 8.2.9, Composer 2.5.8
# 6.3.2 -> 25 Gennaio 2024, PHP 8.2.12, Composer 2.6.5
# 6.5.4 -> 5 Giugno 2024, PHP 8.2.20, Composer 2.7.7
# 6.6.1 -> 31 Luglio 2024, PHP 8.2.22, Composer 2.7.7
# 6.6.2 -> 24 Ottobre 2024, PHP 8.2.25, Composer 2.8.1
# jameelmoses/wordpress-kint-debugger:^2.0 requires PHP >= 8.x
WORDPRESS_TAG=latest
WORDPRESS_ALLOW_EMPTY_PASSWORD=yes
WORDPRESS_DATABASE_HOST=mariadb
WORDPRESS_DATABASE_PORT_NUMBER=3306
WORDPRESS_DATABASE_NAME=wordpress
WORDPRESS_DATABASE_USER=user
WORDPRESS_DATABASE_PASSWORD=
WORDPRESS_USERNAME=admin
WORDPRESS_PASSWORD=password
WORDPRESS_PLUGINS=
WORDPRESS_SMTP_HOST=mailpit
WORDPRESS_SMTP_PORT_NUMBER=1025
WORDPRESS_SMTP_USER=
WORDPRESS_SMTP_PASSWORD=
WORDPRESS_SMTP_PROTOCOL=tls

NODE_TAG=20
NODE_PORT=3000
NODE_ENV=develop
NODE_DEBUG=
NODE_LOG_LEVEL=

PHPMYADMIN_TAG=latest
PHPMYADMIN_HTTP_PORT=8080
PHPMYADMIN_HTTPS_PORT=8443
PHPMYADMIN_ALLOW_NO_PASSWORD=yes
PHPMYADMIN_DATABASE_HOST=mariadb
PHPMYADMIN_DATABASE_USER=user
PHPMYADMIN_DATABASE_PASSWORD=
PHPMYADMIN_DATABASE_PORT_NUMBER=3306
PHPMYADMIN_DATABASE_ENABLE_SSL=no
PHPMYADMIN_DATABASE_SSL_KEY=
PHPMYADMIN_DATABASE_SSL_CERT=
PHPMYADMIN_DATABASE_SSL_CA=
PHPMYADMIN_DATABASE_SSL_CA_PATH=
PHPMYADMIN_DATABASE_SSL_CIPHERS=
PHPMYADMIN_DATABASE_SSL_VERIFY=yes

MAILPIT_TAG=latest
MAILPIT_HTTP_PORT=8025
MAILPIT_MAX_MESSAGES=5000

OPENAI_KEY=

#https://github.com/phpstan/phpstan/issues/3245#issuecomment-702016844
PHPSTAN_PRO_WEB_PORT=11111

# https://nono.ma/github-oauth-token-for-github-com-contains-invalid-characters-on-composer-install
GITHUB_TOKEN=

FRUGAN_UFTYFACF_GOOGLE_OAUTH_CLIENT_ID=
FRUGAN_UFTYFACF_GOOGLE_OAUTH_CLIENT_SECRET=
FRUGAN_UFTYFACF_CACHE_BUSTING_ENABLED=false
15 changes: 15 additions & 0 deletions .gitconfig.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
;https://stackoverflow.com/a/1889699
;https://stackoverflow.com/a/18330114
;https://gist.github.com/pksunkara/988716
;https://dev.to/tomerbendavid/git-configurations-2ngi
;https://spin.atomicobject.com/git-configurations-default/

[core]
autocrlf = input
symlinks = false

[fetch]
prune = true

[pull]
rebase = true
45 changes: 45 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer using any of the [private contact addresses](https://github.com/frugan-dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

For answers to common questions about this code of conduct, see <https://www.contributor-covenant.org/faq>
41 changes: 41 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.

## Development environment setup

To set up a development environment, please follow these steps:

1. Clone the repo

```sh
git clone https://github.com/frugan-dev/upload-field-to-youtube-for-acf
```

2. TODO

## Issues and feature requests

You've found a bug in the source code, a mistake in the documentation or maybe you'd like a new feature? Take a look at [GitHub Discussions](https://github.com/frugan-dev/upload-field-to-youtube-for-acf/discussions) to see if it's already being discussed. You can help us by [submitting an issue on GitHub](https://github.com/frugan-dev/upload-field-to-youtube-for-acf/issues). Before you create an issue, make sure to search the issue archive -- your issue may have already been addressed!

Please try to create bug reports that are:

- _Reproducible._ Include steps to reproduce the problem.
- _Specific._ Include as much detail as possible: which version, what environment, etc.
- _Unique._ Do not duplicate existing opened issues.
- _Scoped to a Single Bug._ One bug per report.

**Even better: Submit a pull request with a fix or new feature!**

### How to submit a Pull Request

1. Search our repository for open or closed
[Pull Requests](https://github.com/frugan-dev/upload-field-to-youtube-for-acf/pulls)
that relate to your submission. You don't want to duplicate effort.
2. Fork the project
3. Create your feature branch (`git checkout -b feat/amazing_feature`)
4. Commit your changes (`git commit -m 'feat: add amazing_feature'`) uses [conventional commits](https://www.conventionalcommits.org), so please follow the specification in your commit messages.
5. Push to the branch (`git push origin feat/amazing_feature`)
6. [Open a Pull Request](https://github.com/frugan-dev/upload-field-to-youtube-for-acf/compare?expand=1)
3 changes: 3 additions & 0 deletions .github/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributors

- [Frugan](https://github.com/frugan-dev) - Creator and main maintainer
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [frugan-dev]
buy_me_a_coffee: frugan
Empty file.
Empty file.
Empty file.
16 changes: 16 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Security Policy

## Reporting a Vulnerability

If there are any vulnerabilities in **upload-field-to-youtube-for-acf**, don't hesitate to _report them_.

1. Use any of the [private contact addresses](https://github.com/frugan-dev).
2. Describe the vulnerability.

If you have a fix, that is most welcome -- please attach or summarize it in your message!

3. We will evaluate the vulnerability and, if necessary, release a fix or mitigating steps to address it. We will contact you to let you know the outcome, and will credit you in the report.

Please **do not disclose the vulnerability publicly** until a fix is released!

4. Once we have either a) published a fix, or b) declined to address the vulnerability for whatever reason, you are free to publicly disclose it.
Empty file added .github/SUPPORT.md
Empty file.
171 changes: 171 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Main

on:
push:
branches:
- 'master'
- 'support/*'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
mariadb_tag: [
latest
]
wordpress_tag: [
5.9.3,
latest
]
node_tag: [
22
]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Set up Docker
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.mariadb_tag }}-${{ matrix.wordpress_tag }}-${{ matrix.node_tag }}-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.mariadb_tag }}-${{ matrix.wordpress_tag }}-${{ matrix.node_tag }}-
- name: Cache npm modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node_tag }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node_tag }}-
#https://stackoverflow.com/a/71334100/3929620
- name: Set environment variables
run: |
PLUGIN_VERSION=$(echo "${GITHUB_REF##*/}" | sed 's/^v//')
echo "PLUGIN_VERSION=$PLUGIN_VERSION" >> $GITHUB_ENV
IS_VALID_TAG=$([[ "${GITHUB_REF##*/}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo true || echo '')
echo "IS_VALID_TAG=$IS_VALID_TAG" >> $GITHUB_ENV
echo "IS_LAST_JOB=$([ $(expr ${{ strategy.job-index }} + 1) = ${{ strategy.job-total }} ] && echo true)" >> $GITHUB_ENV
- name: Print environment variables
run: |
echo "PLUGIN_VERSION=${{ env.PLUGIN_VERSION }}"
echo "IS_VALID_TAG=${{ env.IS_VALID_TAG }}"
echo "IS_LAST_JOB=${{ env.IS_LAST_JOB }}"
- name: Create .env file
run: cp .env.dist .env

# method #1
- name: Install mkcert
run: |
sudo apt-get update && sudo apt-get install libnss3-tools
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
# method #2
#- name: Generate self-signed CA
# uses: kofemann/[email protected]
# with:
# hostcert: 'server.crt'
# hostkey: 'server.key'
# cachain: 'ca-chain.pem'

#- name: Move certificates
# run: |
# mkdir -p tmp/certs
# mv server.crt server.key ca-chain.pem tmp/certs/

- name: Run Makefile 'all' task
run: |
make \
MARIADB_TAG=$MARIADB_TAG \
WORDPRESS_TAG=$WORDPRESS_TAG \
NODE_TAG=$NODE_TAG \
PLUGIN_NAME=${{ github.event.repository.name }} \
PLUGIN_VERSION=${{ env.PLUGIN_VERSION }}
#https://cardinalby.github.io/blog/post/github-actions/implementing-deferred-steps/
# method #1
#- name: Wait for WordPress setup to complete
# run: |
# timeout=300
# while [ $timeout -gt 0 ]; do
# docker compose exec wordpress test -f /bitnami/wordpress/wp-config.php && break
# echo "Waiting for wp-config.php ($timeout seconds left)..."
# sleep 5
# timeout=$((timeout - 5))
# done
# [ $timeout -gt 0 ] || { echo "Error: Timeout reached, wp-config.php not found"; exit 1; }

# method #2
- name: Wait for WordPress setup to complete
run: ./build/docker/logs-catcher.sh wordpress "WordPress setup finished" 180

- name: Run Makefile 'install' task
run: |
make install \
MARIADB_TAG=$MARIADB_TAG \
WORDPRESS_TAG=$WORDPRESS_TAG \
NODE_TAG=$NODE_TAG \
PLUGIN_NAME=${{ github.event.repository.name }} \
PLUGIN_VERSION=${{ env.PLUGIN_VERSION }} \
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- name: Run Makefile 'test' task
run: |
make test \
PLUGIN_NAME=${{ github.event.repository.name }} \
PLUGIN_VERSION=${{ env.PLUGIN_VERSION }}
#https://github.com/orgs/community/discussions/25641#discussioncomment-3248571
- name: Run Makefile 'deploy' task
if: |
github.ref_type == 'tag'
&& env.IS_VALID_TAG
&& env.IS_LAST_JOB
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
run: |
make deploy \
MODE=production \
MARIADB_TAG=$MARIADB_TAG \
WORDPRESS_TAG=$WORDPRESS_TAG \
NODE_TAG=$NODE_TAG \
PLUGIN_NAME=${{ github.event.repository.name }} \
PLUGIN_VERSION=${{ env.PLUGIN_VERSION }} \
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- name: Create release
if: |
github.ref_type == 'tag'
&& env.IS_VALID_TAG
&& env.IS_LAST_JOB
uses: softprops/action-gh-release@v2
with:
# https://github.com/softprops/action-gh-release
# Note that if you intend to run workflows on the release event (on: { release: { types: [published] } }),
# you need to use a personal access token for this action, as the default secrets.GITHUB_TOKEN does not trigger another workflow.
# See: https://github.com/actions/create-release/issues/71
token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
files: dist/${{ github.event.repository.name }}.zip
generate_release_notes: true

- name: Run Makefile 'down' task
run: make down
Loading

0 comments on commit db46060

Please sign in to comment.