-
Notifications
You must be signed in to change notification settings - Fork 7
164 lines (143 loc) · 5.52 KB
/
build-release-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Release and publish
on:
release:
types: [released, prereleased]
env:
PHP_BUILDER_VERSION: "8.3"
NODE_BUILDER_VERSION: "20"
DOCKER_COMPOSE_VERSION: v2.27.0
GITHUB_TOKEN: ${{ secrets.GA_ACCESS_TOKEN }}
VERSION: ${{ github.event.release.tag_name }}
jobs:
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event.release.tag_name != 'staging'
strategy:
matrix:
ps_version: ["1.7.8.10", "8.1.7"]
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: pnpm/action-setup@v3
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_BUILDER_VERSION }}
cache: "pnpm"
cache-dependency-path: e2e/pnpm-lock.yaml
- name: Cache vendor folder
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- name: Install docker compose
run: |
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
rm -f $DOCKER_CONFIG/cli-plugins/docker-compose
curl -SL https://github.com/docker/compose/releases/download/${{ env.DOCKER_COMPOSE_VERSION }}/docker-compose-linux-x86_64 \
-o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
- name: install php dependencies
run: composer install
- name: Install node dependencies and setup e2e
run: pnpm install --no-optional --force
working-directory: e2e
- name: Setup e2e-env with Prestashop ${{ matrix.ps_version }}
run: |
cp .env.dist .env
docker compose build
docker compose up --detach --wait
env:
DOCKER_IMAGE_PRESTASHOP: prestashop/prestashop-flashlight:${{matrix.ps_version}}
working-directory: e2e-env
- name: Run e2e:tests with Prestashop ${{ matrix.ps_version }}
run: pnpm test:e2e
working-directory: e2e
- name: More logs on failure
if: failure()
run: |
docker compose logs cloudsync-mock
docker compose down -v
working-directory: e2e-env
upload_release_assets:
name: Upload zip assets to the release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_BUILDER_VERSION }}
- name: Bundle zips
run: |
make zip-prod
make zip-inte
make zip-e2e
env:
VERSION: ${{ github.event.release.tag_name }}
- name: Get short commit sha
id: commit
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload the zip assets
uses: softprops/action-gh-release@v2
with:
files: |
./dist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip
./dist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_integration.zip
./dist/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}_e2e.zip
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.event.release.tag_name == 'staging' && format('🐣 staging (commit {0})', steps.commit.outputs.sha) || github.event.release.tag_name }}
publish_to_marketplace:
name: Publish the module to the addons marketplace
runs-on: ubuntu-latest
needs:
- e2e-tests
- upload_release_assets
if: ${{ !github.event.release.prerelease && !contains(github.event.release.tag_name, '-') && github.event.release.tag_name != 'staging' }}
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: ${{ env.GITHUB_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 }}
notify_earth:
name: Notify slack internal channels about the release
needs:
- publish_to_marketplace
if: success()
runs-on: ubuntu-latest
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: 8FCE00
SLACK_TITLE: "🚀 PS EventBus ${{ github.event.release.tag_name }} has been released"
SLACK_MESSAGE: ${{ github.event.release.body }}
SLACK_FOOTER: "https://github.com/PrestaShopCorp/ps_eventbus/releases/tag/${{ github.event.release.tag_name }}"
SLACK_USERNAME: QABot
SLACK_CHANNEL: squad-cloudsync
SLACK_ICON: https://raw.githubusercontent.com/PrestaShopCorp/ps_eventbus/main/logo.png