Skip to content

Commit 84fbef0

Browse files
authored
Merge pull request #60 from kabalin/release
Add GitHub Action for release.
2 parents 5723b5e + 6de1daf commit 84fbef0

File tree

4 files changed

+62
-34
lines changed

4 files changed

+62
-34
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags: [ '*' ]
6+
7+
jobs:
8+
release:
9+
name: Create Release
10+
runs-on: ubuntu-18.04
11+
12+
steps:
13+
- name: Check out repository code
14+
uses: actions/checkout@v2
15+
16+
- name: Setup PHP 7.3
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 7.3
20+
ini-values: phar.readonly = false
21+
22+
- name: Build PHAR
23+
run: |
24+
make build/moodle-plugin-ci.phar
25+
php build/moodle-plugin-ci.phar list
26+
27+
- name: Create Release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token does not need to be defined, it is available by default.
32+
with:
33+
tag_name: ${{ github.ref }}
34+
release_name: ${{ github.ref }}
35+
body: |
36+
Take a look at the [CHANGELOG](https://moodlehq.github.io/moodle-plugin-ci/CHANGELOG.html) for details about the release.
37+
Please follow [3.0 Upgrade guide](https://moodlehq.github.io/moodle-plugin-ci/UPGRADE-3.0.html) when upgrading from 2.x.
38+
39+
- name: Upload Release Asset
40+
uses: actions/upload-release-asset@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
upload_url: ${{ steps.create_release.outputs.upload_url }}
45+
asset_path: build/moodle-plugin-ci.phar
46+
asset_name: moodle-plugin-ci.phar
47+
asset_content_type: application/zip

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ jobs:
113113
"$MOODLE_BRANCH" != 'MOODLE_310_STABLE' -a \
114114
"$MOODLE_BRANCH" != 'MOODLE_39_STABLE' ]
115115
moodle-plugin-ci phpdoc
116-
moodle-plugin-ci phpunit --coverage-text
116+
moodle-plugin-ci phpunit
117117
moodle-plugin-ci behat --profile default
118118
moodle-plugin-ci behat --profile chrome

.travis.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,3 @@ jobs:
7777
env: MOODLE_BRANCH=MOODLE_35_STABLE
7878
- php: 7.0
7979
env: MOODLE_BRANCH=MOODLE_35_STABLE
80-
- stage: Deploy
81-
if: tag IS present
82-
before_install: skip
83-
install: skip
84-
script: skip
85-
before_deploy:
86-
- make build/moodle-plugin-ci.phar
87-
- php build/moodle-plugin-ci.phar list
88-
deploy:
89-
provider: releases
90-
api_key: $GITHUB_TOKEN
91-
file: build/moodle-plugin-ci.phar
92-
skip_cleanup: true
93-
on:
94-
repo: moodlehq/moodle-plugin-ci
95-
tags: true

docs/ReleaseNewVersion.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,29 @@ double CI build on Travis, also when merging PR, please **avoid merge commit**
2121
(use "Rebase and merge" option).
2222

2323
Once all code and commits are in place and verified, you need to tag a
24-
release.
25-
26-
__Note:__ Before sending the tag upstream, make sure that Travis is not running any
27-
builds, otherwise tag build might not get triggered. If this happenened, you
28-
need to remove tag and push it again when Travis is not busy.
29-
30-
Tag `master` branch `HEAD` and push using commands:
24+
release. Tag `master` branch `HEAD` and push using commands:
3125

3226
```bash
3327
$ git tag -a 3.1.0 -m "Release version 3.1.0"
3428
$ git push origin 3.1.0
3529
```
3630

37-
(while it's also possible to use GitHub interface, we have decided not to do so, travis
38-
will, automatically, create the needed artifacts and perform the release)
31+
(while it's also possible to use GitHub interface, we have decided not to do
32+
so, GitHub release action will, automatically, create the needed artifacts and
33+
perform the release)
3934

40-
When the tag is pushed, travis will trigger a tag build that contains Deploy stage.
41-
At this stage it should automatically create the `moodle-plugin-ci.phar` release artifact and add it
42-
to the latest release "assets" on GitHub. Verify it has worked correctly by
43-
navigating at [Releases](https://github.com/moodlehq/moodle-plugin-ci/releases).
35+
When the tag is pushed, GitHub release action will be triggered. At this
36+
stage it should automatically create the `moodle-plugin-ci.phar` release
37+
artifact and add it to the latest release "assets" on GitHub. Verify it has
38+
worked correctly by navigating at
39+
[Releases](https://github.com/moodlehq/moodle-plugin-ci/releases).
4440

45-
While in that page, optionally, you can edit the release and add any content to
46-
the description (we use to put some constant links to the changelog / upgrade docs,
47-
but anything important can be commented if needed to).
41+
While in that page, optionally, you can edit the release and add any content
42+
to the description (links to the changelog / upgrade docs are added
43+
automatically but anything important can be commented if needed to).
4844

49-
If there is any problem with that automatic deployment, the artifact will need to be created manually. First build PHAR file manually:
45+
If there is any problem with that automatic deployment, the artifact will need
46+
to be created manually. First build PHAR file manually:
5047

5148
```bash
5249
$ make build/moodle-plugin-ci.phar

0 commit comments

Comments
 (0)