-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (59 loc) · 2.03 KB
/
create-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
name: Update version and create release
on:
pull_request:
types: [closed]
branches:
- master
jobs:
fetch-version:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch latest release version
id: fetch-latest-release
uses: reloc8/[email protected]
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Choose new release version
id: choose-release-version
uses: reloc8/[email protected]
with:
source-branch: ${{ github.event.pull_request.head.ref }}
latest-version: ${{ steps.fetch-latest-release.outputs.latest-release }}
outputs:
new-version: ${{ steps.choose-release-version.outputs.new-version }}
update-version:
needs: fetch-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git pull --ff-only
- name: Update version file
run: echo ${{ needs.fetch-version.outputs.new-version }} > version
- name: Push local repository changes
id: push-local-repository-changes
uses: reloc8/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit-message: "Version ${{ needs.fetch-version.outputs.new-version }}"
outputs:
commit-hash: ${{ steps.push-local-repository-changes.outputs.commit-hash }}
create-release:
needs: [fetch-version, update-version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git pull --ff-only
- name: Create new release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.fetch-version.outputs.new-version }}
release_name: ${{ needs.fetch-version.outputs.new-version }}
draft: false
prerelease: false
commitish: ${{ needs.update-version.outputs.commit-hash }}