Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve release process in GH workflows #788

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/mktp-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id_product" : "5496",
"technical_name" : "autoupgrade",
"display_name" : "1-Click Upgrade - AutoUpgrade",
"channel" : "stable",
"type_upgrade" : "minor",
"product_type" : "module",
"compatible_from": "1.7.0.0"
}
39 changes: 34 additions & 5 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
name: Build
on: [push, pull_request]
name: Build module & upload artifact
on:
workflow_dispatch:
workflow_call:

jobs:
build-and-release-draft:
name: Build & Release draft
uses: PrestaShop/.github/.github/workflows/build-release.yml@master
build:
name: Build dependencies & create artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv, ext-zip

- name: Install composer dependencies
run: composer install --ansi --prefer-dist --no-interaction --no-progress --no-dev

- name: CS Fixer
run: |
vendor/bin/php-cs-fixer fix --diff --using-cache=no

- name: Clean-up project
uses: PrestaShopCorp/[email protected]
with:
paths: storybook

- name: Create & upload artifact
uses: actions/[email protected]
with:
name: ${{ github.event.repository.name }}
path: '.'
71 changes: 71 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish
on:
release:
types: [published]

jobs:
create_artifact:
uses: ./.github/workflows/build-release.yml

create_release_zip:
name: Create and upload the zip asset to the release
runs-on: ubuntu-latest
needs: create_artifact
steps:
- name: Download built artifact
uses: actions/[email protected]
with:
name: ${{ github.event.repository.name }}

- name: Prepare the zip
run: |
cd ../
zip -r ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip ${{ github.event.repository.name }} -x '*.git*'
mv ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip ./${{ github.event.repository.name }}
cd ./${{ github.event.repository.name }}

- name: Publish the zip on release
run: |
gh release upload ${{ github.event.release.tag_name }} ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip -R /${{ github.event.repository.full_name }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish_zip_to_marketplace:
name: Publish zip to the Marketplace
if: github.event.release.prerelease == false
runs-on: ubuntu-latest
needs: create_release_zip
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download release asset
run: |
gh release download ${{ github.event.release.tag_name }} -R ${{ github.event.repository.full_name }} -p ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare publishing tool
run: |
composer global require prestashop/publish-on-marketplace

- name: Release zip
run: |
~/.composer/vendor/bin/publish-on-marketplace --archive=$PWD/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip --metadata-json=$PWD/.github/mktp-metadata.json --changelog="${{ github.event.release.body }}" --debug
env:
MARKETPLACE_API_KEY: ${{ secrets.MARKETPLACE_API_KEY }}

publish_to_sentry_php:
runs-on: ubuntu-latest
if: github.event.release.prerelease == false
steps:
- uses: actions/checkout@v4
- name: Sentry Release PHP
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_PHP }}
with:
environment: production
version: ${{ github.ref }}
1 change: 1 addition & 0 deletions autoupgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct()
$this->author = 'PrestaShop';
$this->version = '5.0.3';
$this->need_instance = 1;
$this->module_key = '926bc3e16738b7b834f37fc63d59dcf8';

$this->bootstrap = true;
parent::__construct();
Expand Down
Loading