This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (118 loc) · 4.09 KB
/
update.yaml
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
name: 'AUR Release Update (Automated)'
on:
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
default: "8.0.0"
type: string
repository_dispatch:
types: [update]
jobs:
setup:
runs-on: ubuntu-latest
name: 'Unify Inputs'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Version (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Repository Dispatch)
if: github.event_name == 'repository_dispatch'
run: |
echo VERSION=${{ github.event.client_payload.version }} >> $GITHUB_ENV
- name: Unified Version
id: version
run: |
INPUT_NAME=${{ inputs.name }}
if [[ ${INPUT_NAME} == '' ]]; then
echo "Name is empty, using default"
echo "name=mondoo" >> $GITHUB_OUTPUT
else
echo "Name: ${INPUT_NAME}"
echo "name=${INPUT_NAME}" >> $GITHUB_OUTPUT
fi
echo "Version: $VERSION"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
update-pkgs:
runs-on: ubuntu-latest
name: 'Generate & Locally Commit PKGBUILDs'
needs: setup
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'master'
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- name: Execute generator (make update)
run: |
make update
- name: 'DEBUG: Show generated package versions'
run: |
echo "mondoo: $(cat mondoo/PKGBUILD | grep orignalVersion=)"
echo "cnquery: $(cat cnquery/PKGBUILD | grep orignalVersion=)"
echo "cnspec: $(cat cnspec/PKGBUILD | grep orignalVersion=)"
- name: Ensure version is new
run: |
if [[ `git status --short | wc -l` == 0 ]]; then
echo "Nothing change... exiting.";
exit 1
fi
- name: Commit new version
run: |
echo "${{ needs.setup.outputs.version }}"
git config --global user.email "tools@mondoo.com"
git config --global user.name "Mondoo Tools"
git add mondoo/PKGBUILD
git add mondoo/.SRCINFO
git add cnquery/PKGBUILD
git add cnquery/.SRCINFO
git add cnspec/PKGBUILD
git add cnspec/.SRCINFO
git commit -m "${{ needs.setup.outputs.version }}"
git push origin master
aur-publish:
name: "Publish packages to Arch User Repository (AUR)"
needs: [setup, update-pkgs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish mondoo AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.5.0
with:
pkgname: mondoo
pkgbuild: ./mondoo/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.setup.outputs.version }}
force_push: 'true'
- name: Publish cnquery AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.5.0
with:
pkgname: cnquery
pkgbuild: ./cnquery/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.setup.outputs.version }}
force_push: 'true'
- name: Publish cnspec AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.5.0
with:
pkgname: cnspec
pkgbuild: ./cnspec/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.setup.outputs.version }}
force_push: 'true'