v7.1.2-beta #308
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
name: Release and publish | |
on: | |
release: | |
types: [released, prereleased] | |
jobs: | |
build: | |
name: Build the base artifact | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.set_version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: | | |
- cwd: _dev/ | |
package_json_file: _dev/package.json | |
args: [--frozen-lockfile, --ignore-scripts] | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_RO }} | |
- name: Setup node env 🏗 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@prestashopcorp' | |
cache: 'pnpm' | |
cache-dependency-path: '_dev/pnpm-lock.yaml' | |
- name: Set version | |
id: set_version | |
run: | | |
echo "version=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//' | cut -d'-' -f1)" >> "$GITHUB_OUTPUT" | |
- name: Bump version | |
run: | | |
VERSION=${{ steps.set_version.outputs.version }} \ | |
make version | |
- name: Scoped dependencies | |
run: make php-scoper | |
- name: Build front | |
run: pnpm --filter ./_dev build | |
- name: Clean-up project 🧹 | |
run: | | |
rm -rf .git | |
rm -rf _dev | |
- name: Create & upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: ${{ github.workspace }} | |
include-hidden-files: true | |
upload_release_asset_production: | |
name: Upload the production zip asset to the release | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
zip_file: ${{ steps.set_zip_file.outputs.zip_file }} | |
steps: | |
- name: Set the zip file | |
id: set_zip_file | |
run: | | |
echo "zip_file=${{ github.event.repository.name }}-${{ needs.build.outputs.version }}.zip" >> "$GITHUB_ENV" | |
echo "zip_file=${{ github.event.repository.name }}-${{ needs.build.outputs.version }}.zip" >> "$GITHUB_OUTPUT" | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: ${{ github.workspace }} | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ secrets.GCLOUD_PROJECT_PRODUCTION }} | |
service_account_key: ${{ secrets.G_CREDENTIAL_PRODUCTION }} | |
export_default_credentials: true | |
- name: Prepare the production zip | |
run: | | |
cd ${{ github.workspace }} | |
sh ./scripts/bundle-module.sh ${{ env.zip_file }} 'prod' | |
- name: Publish the production zip | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ github.workspace }}/dist/${{ env.zip_file }} | |
asset_name: ${{ env.zip_file }} | |
asset_content_type: application/zip | |
upload_release_asset_preprod: | |
name: Upload the preprod zip asset to the release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Set the zip file | |
id: set_zip_file | |
run: | | |
echo "zip_file=${{ github.event.repository.name }}_preprod-${{ needs.build.outputs.version }}.zip" >> "$GITHUB_ENV" | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: ${{ github.workspace }} | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ secrets.GCLOUD_PROJECT_PREPROD }} | |
service_account_key: ${{ secrets.G_CREDENTIAL_PREPROD }} | |
export_default_credentials: true | |
- name: Prepare the preprod zip | |
run: | | |
cd ${{ github.workspace }} | |
sh ./scripts/bundle-module.sh ${{ env.zip_file }} 'preprod' | |
- name: Publish the preprod zip | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ github.workspace }}/dist/${{ env.zip_file }} | |
asset_name: ${{ env.zip_file }} | |
asset_content_type: application/zip | |
publish_to_marketplace: | |
name: Publish the module to the addons marketplace | |
runs-on: ubuntu-latest | |
needs: upload_release_asset_production | |
if: "!github.event.release.prerelease" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2.0.0 | |
- name: Download release asset | |
uses: dsaltares/fetch-gh-release-asset@0.06 | |
with: | |
repo: ${{ github.event.repository.full_name }} | |
version: ${{ github.event.release.id }} | |
file: ${{ needs.upload_release_asset_production.outputs.zip_file }} | |
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/${{ needs.upload_release_asset_production.outputs.zip_file }} \ | |
--metadata-json=$PWD/.github/mktp-metadata.json \ | |
--changelog="${{ github.event.release.body }}" \ | |
--debug | |
env: | |
MARKETPLACE_API_KEY: ${{ secrets.MARKETPLACE_API_KEY }} | |
- name: Notify Slack | |
if: success() | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_COLOR: 0CAD34 | |
SLACK_TITLE: New release published by ${{ github.event.actor.display_login }} | |
SLACK_MESSAGE: Release - ${{ github.event.release.tag_name }} | |
SLACK_FOOTER: '' | |
SLACK_USERNAME: QABot | |
SLACK_CHANNEL: squad-account | |
SLACK_ICON: https://avatars.githubusercontent.com/u/56089550?s=48&v=4 |