Skip to content

v1.75.0-beta.1

v1.75.0-beta.1 #540

Workflow file for this run

name: Publish
on:
release:
types: [published]
env:
PNPM_VERSION: 8
NODE_VERSION: 20
jobs:
build:
name: build dependencies & create artifact
runs-on: ubuntu-latest
steps:
- name: Get tag
id: get_tag
run: |
echo TAG=$(echo $GITHUB_REF | cut -d / -f 3) >> $GITHUB_OUTPUT
echo MAJOR=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d '.' -f 1) >> $GITHUB_OUTPUT
echo MINOR=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d '.' -f 2) >> $GITHUB_OUTPUT
echo PATCH=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d '.' -f 3) >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: '_dev/pnpm-lock.yaml'
- name: Install & build
working-directory: _dev
env:
VUE_APP_BUILD_VERSION: ${{ steps.get_tag.outputs.MAJOR }}.${{ steps.get_tag.outputs.MINOR }}.${{ steps.get_tag.outputs.PATCH }}
run: |
pnpm install
pnpm -r build
- name: Install dev composer dependencies
run: composer install
- name: Generate index.php
run: vendor/bin/autoindex
- name: Install composer dependencies
run: composer install --no-dev -o
- name: Write .env file with specific CDN URL
if: "github.event.release.prerelease"
run: echo 'PSX_MKTG_WITH_GOOGLE_CDN_URL=https://storage.googleapis.com/psxmarketing-cdn/${{ steps.get_tag.outputs.MAJOR }}.${{ steps.get_tag.outputs.MINOR }}.${{ steps.get_tag.outputs.PATCH }}/js/' >> .env
- name: Clean-up project
uses: PrestaShopCorp/[email protected]
with:
paths: 'crowdin.yml'
- name: Create directory with repo name and copy files
run: |
repo_name="${{ github.event.repository.name }}"
mkdir "$repo_name"
shopt -s dotglob nullglob
for file in *; do
if [ "$file" != "$repo_name" ]; then
mv "$file" "$repo_name/"
fi
done
- name: Create & upload artifact
uses: actions/[email protected]
with:
name: ${{ github.event.repository.name }}
path: '.'
include-hidden-files: true
upload_release_asset_production:
name: Upload the production zip asset to the release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: '.'
- name: Prepare the production zip
run: |
zip -r ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip ${{ github.event.repository.name }} -x '*.git*'
- name: Publish the production zip
uses: shogo82148/actions-upload-release-asset@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
upload_release_asset_preproduction:
name: Upload the preproduction zip asset to the release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: '.'
- name: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.G_CREDENTIAL_PREPRODUCTION }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.G_PROJECT_PREPRODUCTION }}
- name: Copy env files
run: |
gcloud components install beta
gcloud beta secrets versions access latest --secret="google-shopping-module" >> ${{ github.event.repository.name }}/.env
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.G_CREDENTIAL_PREPRODUCTION }}
- name: Prepare the preproduction zip
run: |
zip -r ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_preproduction.zip ${{ github.event.repository.name }} -x '*.git*'
- name: Publish the preproduction zip
uses: shogo82148/actions-upload-release-asset@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_preproduction.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_preproduction.zip
asset_content_type: application/zip
upload_release_asset_integration:
name: Upload the integration zip asset to the release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: '.'
- name: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.G_CREDENTIAL_INTEGRATION }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.G_PROJECT_INTEGRATION }}
- name: Copy env files
run: |
gcloud components install beta
gcloud beta secrets versions access latest --secret="google-shopping-module" >> ${{ github.event.repository.name }}/.env
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.G_CREDENTIAL_INTEGRATION }}
- name: Prepare the integration zip
run: |
zip -r ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_integration.zip ${{ github.event.repository.name }} -x '*.git*'
- name: Publish the integration zip
uses: shogo82148/actions-upload-release-asset@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_integration.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_integration.zip
asset_content_type: application/zip
publish_to_marketplace:
name: Publish to the Marketplace
runs-on: ubuntu-latest
needs: upload_release_asset_production
if: github.event.release.prerelease == false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download release asset
uses: dsaltares/[email protected]
with:
repo: ${{ github.event.repository.full_name }}
version: ${{ github.event.release.id }}
file: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip
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 }}
publish_to_sentry_js:
runs-on: ubuntu-latest
if: github.event.release.prerelease == false
steps:
- name: Get tag
id: get_tag
run: |
echo TAG=$(echo $GITHUB_REF | cut -d / -f 3) >> $GITHUB_OUTPUT
echo MAJOR=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d '.' -f 1) >> $GITHUB_OUTPUT
echo MINOR=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d '.' -f 2) >> $GITHUB_OUTPUT
echo PATCH=$(echo $GITHUB_REF | cut -d / -f 3 | cut -d '.' -f 3) >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: '_dev/pnpm-lock.yaml'
- name: Install & build
working-directory: _dev
env:
GENERATE_SOURCEMAPS: true
run: |
pnpm install
pnpm -r build
- name: Sentry Release JS
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_JS }}
with:
environment: production
version: ${{ github.ref }}
sourcemaps: views/js
url_prefix: "~/psxmarketing-cdn/${{ steps.get_tag.outputs.MAJOR }}.x.x/js"