Skip to content

Release and publish #126

Release and publish

Release and publish #126

name: Release and publish
on:
release:
types: [released, prereleased]
jobs:
build:
name: Build the base artifact
runs-on: ubuntu-latest
if: github.event.release.draft == false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install composer dependencies
run: composer install --no-dev -o
- name: Bump version
run: make version
env:
VERSION: ${{ github.event.release.tag_name }}
- name: Create & upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ./
overwrite: 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: Bundle the production zip
run: make zip-prod
env:
CONFIG_FILE: ${{ secrets.PS_EVENTBUS_PRODUCTION_CONFIG }}
VERSION: ${{ github.event.release.tag_name }}
- name: Publish the production zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GA_ACCESS_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ github.event.repository.name }}/dist/${{ 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_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: Bundle the integration zip
run: make zip-inte
- name: Publish the integration zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GA_ACCESS_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ github.event.repository.name }}/dist/${{ 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 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@v4
- name: Download release asset
uses: dsaltares/fetch-gh-release-asset@master
with:
version: tags/${{ github.event.release.tag_name }}
file: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip
token: ${{ secrets.GA_ACCESS_TOKEN }}
- name: Prepare publishing tool
run: |
composer global require prestashop/publish-on-marketplace
- name: Release zip
run: |
export CHANGELOG="${CHANGELOG:=No changelog provided}"
~/.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="$CHANGELOG" \
--api-key="${{ secrets.MARKETPLACE_API_KEY }}" \
--debug
env:
CHANGELOG: ${{ github.event.release.body }}