v2.2.3 #31
Workflow file for this run
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
# .github/workflows/release.yml | |
name: Build and Deploy | |
on: | |
release: | |
types: [published] | |
env: | |
NODE_VERSION: 22 | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: check theme version against tag | |
run: | | |
THEME_VERSION=$(cat sass/style.scss | grep Version | sed -r 's/version: +//I') | |
V="v" | |
echo Version in style.scss: $THEME_VERSION | |
if [ "$V$THEME_VERSION" != "${{ github.event.release.tag_name }}" ]; then exit 1; fi | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install npm packages | |
run: npm ci | |
- name: Build CSS | |
run: npm run compile:build | |
- name: Build CSS-RTL | |
run: npm run compile:rtl | |
- name: Build JS | |
run: npm run build | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
- name: run install composer | |
run: | | |
composer install | |
cd lib && composer install | |
- name: Make bundle | |
run: npm run bundle | |
- name: fail on fork | |
if: github.repository_owner != 'verdigado' | |
run: exit 1 | |
- name: Rename ZIP file | |
run: | | |
mv ../sunflower.zip sunflower-${{ github.event.release.tag_name }}.zip | |
- name: Upload Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "sunflower-${{ github.event.release.tag_name }}.zip" | |
allowUpdates: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Provide deploy_key | |
env: | |
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_USER: 'github-ci' | |
SSH_HOST: 'wordpress05.gcms.verdigado.net' | |
run: | | |
mkdir "$HOME/.ssh" | |
echo "$DEPLOY_KEY" > "$HOME/.ssh/production.key" | |
chmod 600 "$HOME/.ssh/production.key" | |
cat >> ~/.ssh/config <<END | |
Host production | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/production.key | |
StrictHostKeyChecking no | |
END | |
- name: save version | |
run: echo ${{ github.event.release.tag_name }} > version.txt | |
- name: rsync zipfile, version and changelog | |
env: | |
PAGEID: 1952 | |
run: | | |
rsync -a sunflower-${{ github.event.release.tag_name }}.zip version.txt changelog.html production:/var/www/updateserver/ | |
THEME_VERSION=$(cat version.txt | sed -e 's/^v//') | |
sudo locale-gen de_DE.UTF-8 | |
THEME_UPDATE=$(LANG=de_DE.UTF-8 && date +'%B %Y') | |
ssh production "cd /var/www && wp post get $PAGEID --field=content | sed -e 's/<version>[^<]*/<version>$THEME_VERSION/g' | sed -e 's/<versionupdate>[^<]*/<versionupdate>$THEME_UPDATE/g' | sed -E 's/\/updateserver\/sunflower-v(.*)\.zip/\/updateserver\/sunflower-v$THEME_VERSION.zip/g' > /tmp/content-$PAGEID.txt" | |
ssh production "cd /var/www && wp post update $PAGEID - < /tmp/content-$PAGEID.txt && wp option update blogdescription 'Demoseite für das WordPress-Theme Sunflower $THEME_VERSION' --url=sunflower-theme.de/demo && wp option update blogname 'Sunflower $THEME_VERSION' && wp menu item update 147 --url=https://sunflower-theme.de/demo --link=https://sunflower-theme.de/updateserver/sunflower-v$THEME_VERSION.zip" | |
mkdocs: | |
runs-on: ubuntu-latest | |
needs: build-deploy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: mkdocs build | |
uses: Tiryoh/actions-mkdocs@v0 | |
with: | |
mkdocs_version: 'latest' # option | |
# mkdocs_version: '1.1' # option | |
requirements: 'mkdocs/requirements.txt' # option | |
configfile: 'mkdocs/mkdocs.yml' # option | |
- name: Provide deploy_key | |
env: | |
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_USER: 'github-ci' | |
SSH_HOST: 'wordpress05.gcms.verdigado.net' | |
run: | | |
mkdir "$HOME/.ssh" | |
echo "$DEPLOY_KEY" > "$HOME/.ssh/production.key" | |
chmod 600 "$HOME/.ssh/production.key" | |
cat >> ~/.ssh/config <<END | |
Host production | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/production.key | |
StrictHostKeyChecking no | |
END | |
- name: save version | |
run: echo ${GITHUB_REF##*/} > version.txt | |
- name: rsync documentation | |
run: rsync -a --delete documentation/* production:/var/www/documentation/ |