Add workflow to autobump and to run tests on PR

This commit is contained in:
Ettore Di Giacinto 2022-08-17 13:21:58 +00:00
parent c7a453bc1b
commit bd98a26537
2 changed files with 104 additions and 0 deletions

66
.github/workflows/autobump.yaml vendored Normal file
View File

@ -0,0 +1,66 @@
name: Autobump
on:
workflow_dispatch:
schedule:
- cron: '0 20 * * *'
jobs:
bump:
runs-on: ubuntu-latest
env:
GIT_AUTHOR_NAME: "ci-robbot [bot]"
GIT_AUTHOR_EMAIL: robot@c3os.io
GIT_COMMITTER_NAME: "ci-robbot [bot]"
GIT_COMMITTER_EMAIL: robot@c3os.io
WORK_BRANCH: bumps
AUTO_GIT: true
GIT_SIGNOFF: true
LUET_NOLOCK: true
REVBUMP_CHAR: "-"
LUET_YES: true
TOKEN: ${{ secrets.PAT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GITHUB_PRIVATE_KEY: "${{ secrets.BOT_PRIVATE_KEY }}"
GITHUB_PUBLIC_KEY: "${{ secrets.BOT_PUBLIC_KEY }}"
strategy:
matrix:
include:
- upstream_branch: "main"
fork: "git@github.com:ci-forks/packages.git"
upstream_repo: "https://github.com/c3os-io/packages"
name: "packages"
steps:
- env:
HUB_ARGS: "-b ${{ matrix.upstream_branch }}"
FORK_REPO: ${{ matrix.fork }}
UPSTREAM_REPO: ${{ matrix.upstream_repo }}
RESET_BRANCH: ${{ matrix.upstream_branch }}
name: Autobump ${{matrix.name}}
run: |
sudo rm -rf /usr/local/bin/yq
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
sudo luet install -y repository/mocaccino-extra
sudo luet install -y system/luet-extensions system/luet-devkit utils/jq utils/yq vcs/hub utils/dasel
mkdir -p $HOME/.ssh
mkdir -p $HOME/.config
echo "$GITHUB_PRIVATE_KEY" > $HOME/.ssh/id_rsa
echo "$GITHUB_PUBLIC_KEY" > $HOME/.ssh/id_rsa.pub
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub
git clone $FORK_REPO fork
cd fork
git remote add upstream $UPSTREAM_REPO
git fetch --all
git reset --hard upstream/${RESET_BRANCH}
git push -fv
echo "Removing working branch if present"
git branch -D $WORK_BRANCH || true
git checkout -b $WORK_BRANCH
git reset --hard upstream/${RESET_BRANCH}
git push -fv -u origin $WORK_BRANCH
export TREE_DIR=$(ROOT_DIR)/packages
luet autobump-github

38
.github/workflows/pr.yaml vendored Normal file
View File

@ -0,0 +1,38 @@
name: PR build
concurrency:
group: "master-build"
#cancel-in-progress: true
on:
pull-request:
jobs:
build:
runs-on: ubuntu-latest
env:
ARCH: amd64
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
mkdir build
- name: Download meta 🔧
uses: luet-lab/luet-github-action@master
with:
FINAL_REPO: quay.io/c3os/packages
REPOSITORY_TYPE: docker
downloadAllMeta: true
downloadFromList: true
downloadMeta: true
- name: Build packages 🔧
uses: luet-lab/luet-github-action@master
with:
build: true
fromIndex: true
onlyMissing: true
FINAL_REPO: quay.io/c3os/packages
DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }}
REPOSITORY_TYPE: docker
pushFinalImages: false
pushCache: false