From 07e94304527a1c0be48e6a8433f555ce5057989a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 1 Dec 2023 19:22:24 +0100 Subject: [PATCH] Added autosubmission GitHub Action --- .github/workflows/osc/configure_osc.sh | 15 ++++++++++ .github/workflows/osc/oscrc.template | 8 +++++ .github/workflows/submit.yml | 41 ++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100755 .github/workflows/osc/configure_osc.sh create mode 100644 .github/workflows/osc/oscrc.template create mode 100644 .github/workflows/submit.yml diff --git a/.github/workflows/osc/configure_osc.sh b/.github/workflows/osc/configure_osc.sh new file mode 100755 index 00000000..193164b4 --- /dev/null +++ b/.github/workflows/osc/configure_osc.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +# This helper script creates the "osc" configuration file with OBS credentials + +CONFIG_FILE="$HOME/.config/osc/oscrc" + +# do not overwrite the existing config accidentally +if [ -e "$CONFIG_FILE" ]; then + echo "ERROR: $CONFIG_FILE already exists" + exit 1 +fi + +TEMPLATE=$(dirname "${BASH_SOURCE[0]}")/oscrc.template +mkdir -p $(dirname "$CONFIG_FILE") +sed -e "s/@OBS_USER@/$OBS_USER/g" -e "s/@OBS_PASSWORD@/$OBS_PASSWORD/g" "$TEMPLATE" > "$CONFIG_FILE" diff --git a/.github/workflows/osc/oscrc.template b/.github/workflows/osc/oscrc.template new file mode 100644 index 00000000..fd38b858 --- /dev/null +++ b/.github/workflows/osc/oscrc.template @@ -0,0 +1,8 @@ +[general] +apiurl = https://api.opensuse.org + +[https://api.opensuse.org] +user=@OBS_USER@ +pass=@OBS_PASSWORD@ +credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager +trusted_prj=YaST:Head openSUSE:Factory diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml new file mode 100644 index 00000000..e6ebf178 --- /dev/null +++ b/.github/workflows/submit.yml @@ -0,0 +1,41 @@ +# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions + +name: Submit + +on: + # allow running manually + workflow_dispatch: + # when committing to master + push: + # FIXME: + # branches: master + branches: autosubmission + +jobs: + submit: + # do not run in forks + if: github.repository == 'yast/yast-devtools' + + runs-on: ubuntu-latest + + container: + image: registry.opensuse.org/yast/head/containers_tumbleweed/yast-rake:latest + # "osc build" needs to mount /proc in the build system chroot + options: --privileged + + steps: + - name: Git Checkout + uses: actions/checkout@v4 + + - name: Fix permissions to avoid git failures + run: chown -R -c 0 . + + - name: Configure osc + run: .github/workflows/osc/configure_osc.sh + env: + OBS_USER: ${{ secrets.OBS_USER }} + OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }} + + - name: Run rake + run: rake osc:build + \ No newline at end of file