Skip to content

Commit

Permalink
Allow only newer versions in the deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench committed Sep 2, 2023
1 parent 9b354e1 commit cf5e364
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,29 @@ jobs:
create-signed-phar-file:
runs-on: ubuntu-latest
steps:
- name: Checkout HEAD
uses: actions/[email protected]

# 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-magerun2/master/version.txt | tr -d '[:space:]')
echo "pushed_version=$PUSHED_VERSION" >> $GITHUB_ENV
echo "latest_released_version=$LATEST_RELEASED_VERSION" >> $GITHUB_ENV
- uses: jackbilestech/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
head: '${{ env.pushed_version }}'
base: '${{ env.latest_released_version }}'

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:2
php-version: '7.4'

- name: Checkout HEAD
uses: actions/[email protected]

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

Expand Down Expand Up @@ -67,14 +81,6 @@ jobs:
name: n98-magerun2.phar
path: .

- name: rename phar file (deploy test)
if: github.ref == 'refs/heads/deploy'
run: |
TAG=deploy-test-1.2.3
mv n98-magerun2.phar n98-magerun2-${TAG}.phar
mv n98-magerun2.phar.asc n98-magerun2-${TAG}.phar.asc
ls -l
- name: rename phar file (develop / unstable)
if: github.ref == 'refs/heads/develop'
run: |
Expand All @@ -87,6 +93,7 @@ jobs:
run: |
# get tag part of github.ref
TAG=$(cut -d'/' -f3 <<< "$GITHUB_REF")
LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/netz98/n98-magerun2/master/version.txt | tr -d '[:space:]')
cp n98-magerun2.phar n98-magerun2-${TAG}.phar
cp n98-magerun2.phar.asc n98-magerun2-${TAG}.phar.asc
mv n98-magerun2.phar n98-magerun2-latest.phar
Expand Down Expand Up @@ -125,7 +132,7 @@ jobs:
update-dist-repo:
runs-on: ubuntu-latest
needs: [ "create-signed-phar-file" ]
needs: [ "check-semantic-versioning", "create-signed-phar-file" ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout HEAD
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ phpunit.xml
super-linter.log

# Act
act.env
act.secrets
/act*

0 comments on commit cf5e364

Please sign in to comment.