-
Notifications
You must be signed in to change notification settings - Fork 7
115 lines (109 loc) · 3.41 KB
/
build-packages.yml
File metadata and controls
115 lines (109 loc) · 3.41 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
name: Build Packages
on:
push:
branches:
- build
tags:
- 'v*.*.*'
jobs:
prebuild:
runs-on: buildinator-5
outputs:
manifest: ${{ steps.prebuild.outputs.manifest }}
matrix: ${{ steps.prebuild.outputs.matrix }}
uuid: ${{ steps.prebuild.outputs.uuid }}
steps:
- name: Checkout
uses: actions/checkout@v3
- id: prebuild
name: Prebuild flow
uses: 45drives/actions/prebuild-flow@main
with:
directory: ${{ github.workspace }}
build:
needs: prebuild
runs-on: buildinator-group
strategy:
matrix:
build: ${{ fromJSON(needs.prebuild.outputs.matrix).include }}
steps:
- name: Build package
uses: 45drives/actions/build-package@main
with:
manifest: ${{ needs.prebuild.outputs.manifest }}
build: ${{ toJSON(matrix.build) }}
uuid: ${{ needs.prebuild.outputs.uuid }}
sign:
needs:
- prebuild
- build
runs-on: buildinator-5
steps:
- name: Run sign playbook
uses: 45drives/actions/ansible-playbook@main
with:
playbook: /root/git/auto-packaging/actions/ansible/sign.yml
directory: ${{ github.workspace }}/packaging
group_vars_directory: ${{ github.workspace }}/packaging/group_vars/
inventory: |
[ci]
localhost
become: true
host_key_checking: true
extra_vars: sign_key_name=prod
update_repositories:
needs:
- prebuild
- build
- sign
runs-on: buildinator-5
steps:
- id: push_local
name: Push packages into local repository
uses: 45drives/actions/update-repo@main
with:
directory: ${{ github.workspace }}
create_release:
needs:
- prebuild
- build
- sign
- update_repositories
runs-on: buildinator-5
permissions:
contents: write
steps:
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "PRERELEASE=$([ "$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.stable')" = "true" ] && echo false || echo "true")" >> $GITHUB_ENV
echo "TITLE=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.title')" >> $GITHUB_ENV
echo "VERSION=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.version')" >> $GITHUB_ENV
echo "REVISION=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.build_number')" >> $GITHUB_ENV
- name: GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
name: ${{env.TITLE}} ${{env.VERSION}}
prerelease: ${{env.PRERELEASE}}
body_path: ${{github.workspace}}/CHANGELOG.md
files: |
/mnt/ci_artifacts/${{ needs.prebuild.outputs.uuid }}/sign/**/*.deb
/mnt/ci_artifacts/${{ needs.prebuild.outputs.uuid }}/sign/**/*.rpm
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
sync_repositories:
needs:
- prebuild
- build
- sign
- update_repositories
- create_release
runs-on: buildinator-5
steps:
- id: push_remote
name: Sync local repository with remote repository
if: startsWith(github.ref, 'refs/tags/')
uses: 45drives/actions/sync-repo@main
with:
directory: ${{ github.workspace }}