Skip to content

Commit ce5360b

Browse files
committed
Add Github action release builder
1 parent 548e98e commit ce5360b

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

.github/release-drafter.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name-template: v$NEXT_PATCH_VERSION
2+
tag-template: v$NEXT_PATCH_VERSION
3+
categories:
4+
- title: 🔨 Improvements
5+
label: enhancement
6+
- title: 🐛 Bug Fixes
7+
label: bug
8+
- title: 🚀 New Features
9+
label: Feature
10+
change-template: '- #$NUMBER: $TITLE by @$AUTHOR'
11+
template: |
12+
# Changes
13+
$CHANGES
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build & Release draft
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
deploy:
11+
name: build dependencies & create artifact
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2.0.0
16+
- name: Build JS dependencies
17+
uses: PrestaShopCorp/github-action-build-js/12@v1.0
18+
with:
19+
cmd: npm
20+
path: ./_dev
21+
- name: Install composer dependencies
22+
run: composer install --no-dev -o
23+
- name: Clean-up project
24+
uses: PrestaShopCorp/github-action-clean-before-deploy@v1.0
25+
- name: Create & upload artifact
26+
uses: actions/upload-artifact@v1
27+
with:
28+
name: ${{ github.event.repository.name }}
29+
path: ../
30+
update_release_draft:
31+
runs-on: ubuntu-latest
32+
needs: [deploy]
33+
if: github.event_name == 'push'
34+
steps:
35+
- name: Download artifact
36+
uses: actions/download-artifact@v1
37+
with:
38+
name: ${{ github.event.repository.name }}
39+
- id: release_info
40+
uses: toolmantim/release-drafter@v5
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Prepare for Release
44+
run: |
45+
cd ${{ github.event.repository.name }}
46+
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
47+
- name: Clean existing assets
48+
shell: bash
49+
run: |
50+
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
51+
assets=`bin/hub api -t repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.id }}/assets | awk '/\].url/ { print $2 }'`
52+
for asset in $assets
53+
do
54+
bin/hub api -X DELETE $asset
55+
done
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
- name: Publish to GitHub Release
59+
uses: actions/upload-release-asset@v1.0.1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ steps.release_info.outputs.upload_url }}
64+
asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip
65+
asset_name: ${{ github.event.repository.name }}.zip
66+
asset_content_type: application/zip

0 commit comments

Comments
 (0)