-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (89 loc) · 3.46 KB
/
release.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
name: 'release'
on:
push:
tags: ['*']
jobs:
deploy-bmlt-portal-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
id: code-checkout
- name: Validate composer.json and composer.lock
id: composer-validate
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
id: install-dependencies
run: composer install --no-dev --prefer-dist --no-progress --no-suggest --classmap-authoritative
- name: Prepare zip file
run: |
export ARTIFACT_FILE=bmlt-portal
export ARTIFACT_FILENAME=bmlt-portal.zip
echo "ARTIFACT_FILENAME=${ARTIFACT_FILENAME}" >> $GITHUB_ENV
git archive --format=zip --output=${ARTIFACT_FILENAME} --prefix=${ARTIFACT_FILE}/ ${GITHUB_SHA}
unzip ${ARTIFACT_FILENAME}
rm ${ARTIFACT_FILENAME}
echo ${GITHUB_SHA} > ${ARTIFACT_FILE}/build.txt
cp -R vendor ${ARTIFACT_FILE}/
zip -r -9 ${ARTIFACT_FILENAME} ${ARTIFACT_FILE}
curl -sLO https://raw.githubusercontent.com/bmlt-enabled/release-notes-tool/master/gh-release-notes.sh
chmod +x gh-release-notes.sh
./gh-release-notes.sh CHANGELOG.md "##"
- name: Prepare artifact metadata
id: prepare_artifact_metadata
run: |
echo ::set-output name=ARTIFACT_PATH::./${ARTIFACT_FILENAME}
echo ::set-output name=ARTIFACT_NAME::${ARTIFACT_FILENAME}
- name: Release beta
if: contains(github.ref, 'beta')
id: beta_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
prerelease: true
draft: false
- name: Upload Beta Asset
if: contains(github.ref, 'beta')
id: beta-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.beta_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_PATH }}
asset_name: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_NAME }}
asset_content_type: application/zip
- name: Release stable
if: "!contains(github.ref, 'beta')"
id: stable_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: "changelog.txt"
prerelease: false
draft: false
- name: Upload Stable Asset
if: "!contains(github.ref, 'beta')"
id: stable-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.stable_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_PATH }}
asset_name: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_NAME }}
asset_content_type: application/zip