Skip to content

Bump the wp-packages group with 24 updates (#395) #212

Bump the wp-packages group with 24 updates (#395)

Bump the wp-packages group with 24 updates (#395) #212

Workflow file for this run

---
name: Nightly Build
on:
push:
branches:
- main
# 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@v4
- name: Get current tag for HEAD
run: |
echo "CURRENT_TAG=$(git tag --points-at HEAD)" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
if: ${{ env.CURRENT_TAG != 'nightly' }}
with:
php-version: latest
coverage: none
tools: wp-cli
- name: Install latest version of dist-archive-command
if: ${{ env.CURRENT_TAG != 'nightly' }}
run: wp package install wp-cli/dist-archive-command:dev-main
- name: Setup Node
uses: actions/setup-node@v4
if: ${{ env.CURRENT_TAG != 'nightly' }}
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
if: ${{ env.CURRENT_TAG != 'nightly' }}
run: npm ci
- name: Build plugin
if: ${{ env.CURRENT_TAG != 'nightly' }}
run: npm run build
- name: Update version number
if: ${{ env.CURRENT_TAG != 'nightly' }}
run: |
sed -i -e "s/Version: 0.0.2/Version: 0.0.2-$GITHUB_SHA/g" ./media-experiments.php
- name: Create ZIP file
if: ${{ env.CURRENT_TAG != 'nightly' }}
run: wp dist-archive . ./media-experiments.zip
- name: Prepare GitHub Pages
if: ${{ env.CURRENT_TAG != 'nightly' }}
run: |
mkdir -p _site
cp ./media-experiments.zip _site/nightly.zip
- name: Upload artifact
if: ${{ env.CURRENT_TAG != 'nightly' }}
uses: actions/upload-pages-artifact@v3
- name: Delete existing release
uses: actions/github-script@v7
if: ${{ env.CURRENT_TAG != 'nightly' }}
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
if: ${{ env.CURRENT_TAG != 'nightly' }}
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
- name: Publish Release
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564
if: ${{ env.CURRENT_TAG != 'nightly' }}
with:
tag_name: nightly
name: Nightly Build
target_commitish: ${{ github.ref }}
draft: false
prerelease: true
generate_release_notes: true
files: |
media-experiments.zip
fail_on_unmatched_files: true
# Deployment job
deploy:
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