This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |