-
Notifications
You must be signed in to change notification settings - Fork 4
156 lines (136 loc) · 4.77 KB
/
release.yml
File metadata and controls
156 lines (136 loc) · 4.77 KB
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
name: Release
on:
push:
tags:
- v*
workflow_call:
inputs:
tagname:
description: 'The git tag name for release'
default: ''
required: true
type: string
workflow_dispatch:
jobs:
validate:
name: Validate release tag
runs-on: ubuntu-latest
outputs:
# Normalize the tag, version and ref names here so they can be
# used below.
tag: ${{ steps.set-tag.outputs.tag }}
version: ${{ steps.set-tag.outputs.version }}
ref: "refs/tags/${{ steps.set-tag.outputs.tag }}"
# Don't trigger app builds for major or rc releases since they're
# likely to fail or be broken.
trigger-apps: >-
${{ (endsWith(steps.set-tag.outputs.tag, '.0.0') || contains(steps.set-tag.outputs.tag, 'rc')) && 'false' || 'true' }}
steps:
- name: Validate tagname input
if: ${{ inputs.tagname && !startsWith(inputs.tagname, 'v') }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Input tagname must begin with v')
- name: Validate triggered ref
if: ${{ !inputs.tagname && !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Release must run from a v* tag')
- name: Normalize tag name and version
id: set-tag
run: |
tag="${{ inputs.tagname && inputs.tagname || github.ref_name }}"
version="${tag#v}"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
build:
name: Build
needs: validate
uses: ./.github/workflows/main.yml
with:
ref: ${{ needs.validate.outputs.ref }}
release:
name: Release
runs-on: ubuntu-latest
needs: [validate, build]
steps:
# If you download all artifacts or a single artifact while
# specifying path, download-artifact creates an extra directory
# with the artifact name. We just want the single artifacts, so
# download them individually into the current directory.
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.whl-filename }}
- name: Download tarball
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.tar-filename }}
- name: Download apps-bundle.zip
uses: actions/download-artifact@v3
with:
name: apps-bundle.zip
- name: Download loading-screen.zip
uses: actions/download-artifact@v3
with:
name: loading-screen.zip
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.validate.outputs.tag }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
${{ needs.build.outputs.whl-filename }}
${{ needs.build.outputs.tar-filename }}
apps-bundle.zip
loading-screen.zip
- name: Move PyPI artifacts to dist directory
run: |
mkdir -p dist
mv "${{ needs.build.outputs.whl-filename }}" dist
mv "${{ needs.build.outputs.tar-filename }}" dist
- name: Release to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
trigger_endless-key-app:
name: Trigger endless-key-app release
runs-on: ubuntu-latest
needs: [validate, release]
if: ${{ fromJSON(needs.validate.outputs.trigger-apps) }}
steps:
- name: Trigger building endless-key-app
uses: actions/github-script@v6
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
script: |
await github.rest.repos.createDispatchEvent({
owner: "endlessm",
repo: "endless-key-app",
event_type: "kolibri-explore-plugin-release",
client_payload: {
VERSION: "${{ needs.validate.outputs.tag }}",
}
})
trigger_kolibri-installer-android:
name: Trigger kolibri-installer-android release
runs-on: ubuntu-latest
needs: [validate, release]
if: ${{ fromJSON(needs.validate.outputs.trigger-apps) }}
steps:
- name: Trigger building kolibri-installer-android
uses: actions/github-script@v6
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
script: |
await github.rest.repos.createDispatchEvent({
owner: "endlessm",
repo: "kolibri-installer-android",
event_type: "kolibri-explore-plugin-release",
client_payload: {
VERSION: "${{ needs.validate.outputs.version }}",
}
})