Skip to content

Bump actions/checkout from 5 to 6 in the github-actions group (#42) #69

Bump actions/checkout from 5 to 6 in the github-actions group (#42)

Bump actions/checkout from 5 to 6 in the github-actions group (#42) #69

Workflow file for this run

name: Nightly Build
on:
push:
branches:
- main
tags-ignore:
- nightly
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
pages: write
id-token: write
jobs:
build:
name: Nightly Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: latest
coverage: none
tools: wp-cli
- name: Install PHP dependencies
uses: ramsey/composer-install@v3
with:
composer-options: '--prefer-dist --no-progress --no-interaction --no-scripts --no-dev'
- name: Install latest version of dist-archive-command
run: wp package install wp-cli/dist-archive-command:dev-main
- name: Update version number
run: |
CURRENT_DATE=$(date +%Y.%-m.%-d)
sed -i -e "s/Version:.*/Version: 0.1.$CURRENT_DATE-${GITHUB_SHA::7}/g" ./mcp.php
- name: Create updates information
run: |
CURRENT_DATE=$(date +%Y.%m.%d)
cat > update.json <<-END
{
"id": "https://mcp-wp.github.io/mcp-server/update.json",
"slug": "mcp",
"version": "0.1.$CURRENT_DATE-${GITHUB_SHA::7}",
"url": "https://github.com/mcp-wp/mcp-server",
"package": "https://mcp-wp.github.io/mcp-server/mcp.zip",
"tested": "6.8",
"requires_php": "8.2",
"autoupdate": true
}
END
- name: Create ZIP file
run: wp dist-archive --plugin-dirname=mcp . ./mcp.zip
- name: Prepare GitHub Pages
run: |
mkdir -p _site
mv update.json _site/update.json
cp ./mcp.zip _site/mcp.zip
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
- name: Delete existing release
uses: actions/github-script@v8
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
const response = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: "nightly"
});
github.rest.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: response.data.id,
});
} catch {}
- name: Tag current commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "swissspidy-bot"
git push origin :refs/tags/nightly
git tag -f nightly
git push origin --tags
deploy:
name: Deployment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4