Rename netz98 to valantic CEC #127
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: Deploy | |
on: | |
push: | |
branches: | |
- develop | |
- deploy | |
tags: | |
# only tags with semver format | |
- '[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
jobs: | |
create-signed-phar-file: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout HEAD | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
tools: composer:2 | |
php-version: '7.4' | |
# Allow only newer versions | |
- name: Collect versions | |
run: | | |
# extract tag part of github.ref | |
PUSHED_VERSION=$(cut -d'/' -f3 <<< "$GITHUB_REF") | |
LATEST_RELEASED_VERSION=$(curl -s https://raw.githubusercontent.com/netz98/n98-magerun/master/version.txt | tr -d '[:space:]') | |
echo "pushed_version=$PUSHED_VERSION" >> $GITHUB_ENV | |
echo "latest_released_version=$LATEST_RELEASED_VERSION" >> $GITHUB_ENV | |
- uses: jackbilestech/semver-compare@1.0.4 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
head: '${{ env.pushed_version }}' | |
base: '${{ env.latest_released_version }}' | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Create phar | |
run: bash ./build.sh | |
- name: Run phar file | |
run: php n98-magerun.phar --version | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: GPG sign phar file (detached) | |
run: | | |
echo "${{ secrets.GPG_PASSPHRASE }}" | \ | |
gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --detach-sign -a \ | |
-o n98-magerun.phar.asc n98-magerun.phar | |
env: | |
GPG_TTY: $(tty) | |
- name: GPG verify phar file | |
run: gpg --verify n98-magerun.phar.asc n98-magerun.phar | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: n98-magerun.phar | |
path: | | |
n98-magerun.phar | |
n98-magerun.phar.asc | |
update-files-magerun-net: | |
runs-on: ubuntu-latest | |
needs: ["create-signed-phar-file"] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: n98-magerun.phar | |
path: . | |
- name: rename phar file (deploy test) | |
if: github.ref == 'refs/heads/deploy' | |
run: | | |
TAG=deploy-test-1.2.3 | |
mv n98-magerun.phar n98-magerun-${TAG}.phar | |
mv n98-magerun.phar.asc n98-magerun-${TAG}.phar.asc | |
ls -l | |
- name: rename phar file (develop / unstable) | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
mv n98-magerun.phar n98-magerun-dev.phar | |
mv n98-magerun.phar.asc n98-magerun-dev.phar.asc | |
ls -l | |
- name: rename phar file (tag) | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
# get tag part of github.ref | |
TAG=$(cut -d'/' -f3 <<< "$GITHUB_REF") | |
cp n98-magerun.phar n98-magerun-${TAG}.phar | |
cp n98-magerun.phar.asc n98-magerun-${TAG}.phar.asc | |
mv n98-magerun.phar n98-magerun-latest.phar | |
mv n98-magerun.phar.asc n98-magerun-latest.phar.asc | |
ls -l | |
- name: Upload phar file to files.magerun.net | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SSH_DEPLOY_HOST }} | |
username: ${{ secrets.SSH_DEPLOY_USERNAME }} | |
key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} | |
passphrase: ${{ secrets.SSH_DEPLOY_PASSPHRASE }} | |
source: '*.phar,*.phar.asc' | |
target: ${{ secrets.SSH_DEPLOY_TARGET }} | |
rm: false | |
overwrite: true | |
- name: Run update tasks on files.magerun.net | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.SSH_DEPLOY_HOST }} | |
username: ${{ secrets.SSH_DEPLOY_USERNAME }} | |
key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} | |
passphrase: ${{ secrets.SSH_DEPLOY_PASSPHRASE }} | |
script: | | |
build/build_phive.sh | |
curl -s https://files.magerun.net/list.php > public/index.html | |
- name: Invalidate cloudflare | |
run: | | |
curl -X POST 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache' \ | |
-H 'Content-Type:application/json' \ | |
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_TOKEN }}" \ | |
--data-raw '{"purge_everything":true}' | |
update-dist-repo: | |
runs-on: ubuntu-latest | |
needs: [ "create-signed-phar-file" ] | |
steps: | |
- name: Checkout HEAD | |
uses: actions/checkout@v4 | |
- uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.DIST_REPO_DEPLOY_KEY }} | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: n98-magerun.phar | |
- name: Update dist repo | |
env: | |
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | |
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} | |
run: bash .github/workflows/update-dist-repo.sh | |
create-github-release: | |
runs-on: ubuntu-latest | |
needs: [ "create-signed-phar-file" ] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout HEAD | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: n98-magerun.phar | |
- name: 'Build Changelog' | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
owner: "netz98" | |
repo: "n98-magerun" | |
id: build_changelog | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body: ${{steps.build_changelog.outputs.changelog}} | |
files: | | |
n98-magerun.phar | |
n98-magerun.phar.asc | |