37 hitting f5 on the full scan page will trigger a full scan #152
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: github release | |
on: | |
push: | |
branches: [ | |
"main", | |
# this should be mainly branch releases for created issues | |
"[0-9]-*" | |
] | |
tags: ["*"] | |
pull_request: | |
branches: ["*"] | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
outputs: | |
plugin_version: ${{ steps.get-version.outputs.plugin_version }} | |
plugin_prerelease: ${{ steps.get-version.outputs.plugin_prerelease }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
echo "running tag version extract" | |
echo "plugin_version=${GITHUB_REF_NAME#v}" | tee -a "$GITHUB_OUTPUT" | |
echo "plugin_prerelease=false" | tee -a "$GITHUB_OUTPUT" | |
elif [[ $GITHUB_REF == refs/head/main ]]; then | |
echo "running main version extract from file" | |
PLUGIN_VERSION=$(cat gdata-antivirus.php | sed -nE 's/^.*Version: ([0-9a-z\.\-])/\1/p') | |
echo "plugin_version=$PLUGIN_VERSION" | tee -a "$GITHUB_OUTPUT" | |
echo "plugin_prerelease=false" | tee -a "$GITHUB_OUTPUT" | |
elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
echo "running pull request version extract from file" | |
PLUGIN_VERSION=$(cat gdata-antivirus.php | sed -nE 's/^.*Version: ([0-9a-z\.\-])/\1/p') | |
PLUGIN_VERSION_SUFFIX=${GITHUB_HEAD_REF//\//_}-${{ github.run_id }} | |
echo "plugin_version=$PLUGIN_VERSION-$PLUGIN_VERSION_SUFFIX" | tee -a "$GITHUB_OUTPUT" | |
echo "plugin_prerelease=true" | tee -a "$GITHUB_OUTPUT" | |
else | |
echo "running branch version extract from file" | |
PLUGIN_VERSION=$(cat gdata-antivirus.php | sed -nE 's/^.*Version: ([0-9a-z\.\-])/\1/p') | |
PLUGIN_VERSION_SUFFIX=${GITHUB_REF_NAME//\//_}-${{ github.run_id }} | |
echo "plugin_version=$PLUGIN_VERSION-$PLUGIN_VERSION_SUFFIX" | tee -a "$GITHUB_OUTPUT" | |
echo "plugin_prerelease=true" | tee -a "$GITHUB_OUTPUT" | |
fi | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/devcontainers/php:1-8.2-bullseye | |
steps: | |
- uses: actions/checkout@v4 | |
- name: composer install | |
run: composer install | |
- name: phpunit | |
run: ./vendor/bin/phpunit --testdox tests/ | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
needs: | |
- get-version | |
- test | |
container: | |
image: mcr.microsoft.com/devcontainers/php:1-8.2-bullseye | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install scoper | |
run: | | |
composer global require humbug/php-scoper | |
echo "$(composer config home)/vendor/bin/" >> $GITHUB_PATH | |
cp memory.ini /usr/local/etc/php/conf.d/memory.ini | |
- name: run scoper | |
run: | | |
source scoper.sh | |
- name: replace version | |
run: bash set-version.sh "${{needs.get-version.outputs.plugin_version}}" | |
- name: zip it | |
run: | | |
pushd scoped-code/ | |
zip -r gdata-antivirus-${{needs.get-version.outputs.plugin_version}}.zip * --exclude @.zipignore | |
mv gdata-antivirus-${{needs.get-version.outputs.plugin_version}}.zip ../ | |
popd | |
- uses: actions/upload-artifact@master | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
name: plugin-zip | |
path: gdata-antivirus-${{needs.get-version.outputs.plugin_version}}.zip | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: | |
- get-version | |
- build | |
steps: | |
- name: download artifact | |
uses: actions/download-artifact@master | |
with: | |
name: plugin-zip | |
- name: install subversion | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install subversion | |
- name: checkout svn | |
run: | | |
svn co https://plugins.svn.wordpress.org/gdata-antivirus/ svn/gdata-antivirus | |
- name: unzip | |
run: unzip gdata-antivirus-${{needs.get-version.outputs.plugin_version}}.zip -d svn/gdata-antivirus-${{needs.get-version.outputs.plugin_version}} | |
- name: check version changelog | |
run: grep "= ${{needs.get-version.outputs.plugin_version}} =" svn/gdata-antivirus-${{needs.get-version.outputs.plugin_version}}/readme.txt | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: gdata-antivirus-${{needs.get-version.outputs.plugin_version}}.zip | |
tag_name: ${{needs.get-version.outputs.plugin_version}} | |
prerelease: ${{needs.get-version.outputs.plugin_prerelease}} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
generate_release_notes: true |