-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (71 loc) · 2.34 KB
/
deploy.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
# Required PAT repository permissions:
# - Actions: RO
# - Contents: RW
# - Secrets: RO
name: Deploy
on:
workflow_run:
workflows:
- Assemble
types:
- completed
jobs:
setup_env:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
outputs:
commit_subject: ${{ steps.output1.outputs.commit_subject }}
release_tag: ${{ steps.output2.outputs.release_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: output1
run: echo "commit_subject=$(git log -1 --format=%s)" >> $GITHUB_OUTPUT
- id: output2
run: echo "release_tag=$(git log -1 --format=%s | sed 's/.*Release //')" >> $GITHUB_OUTPUT
deploy:
needs: setup_env
env:
APK_NAME: 'app-release.apk'
APK_CONTENT_TYPE: 'application/vnd.android.package-archive'
COMMIT_SUBJECT: ${{ needs.setup_env.outputs.commit_subject }}
RELEASE_TAG: ${{ needs.setup_env.outputs.release_tag }}
if: ${{ startsWith(needs.setup_env.outputs.commit_subject, 'Release v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download apk
id: download_apk
uses: actions/download-artifact@v4
with:
name: ${{ env.APK_NAME }}
github-token: ${{ secrets.GH_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
- name: Create tag
uses: rickstaa/action-create-tag@v1
id: tag_create
with:
message: ${{ env.COMMIT_SUBJECT }}
tag: ${{ env.RELEASE_TAG }}
- name: Build changelog
id: build_changelog
uses: requarks/changelog-action@v1
with:
includeInvalidCommits: true
tag: ${{ env.RELEASE_TAG }}
token: ${{ secrets.GH_TOKEN }}
- name: Create release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactContentType: ${{ env.APK_CONTENT_TYPE }}
artifacts: ${{ format('{0}/{1}', steps.download_apk.outputs.download-path, env.APK_NAME) }}
body: ${{ steps.build_changelog.outputs.changes }}
draft: false
makeLatest: true
tag: ${{ env.RELEASE_TAG }}
token: ${{ secrets.GH_TOKEN }}