From ff3b717663b3423898b3ae214545a9cb22d28f31 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Mon, 5 Feb 2024 23:50:27 +0100 Subject: [PATCH] Add setup-copr-cli action --- .github/actions/promote-snapshot/action.yml | 17 +++------------ .github/actions/setup-copr-cli/action.yml | 24 +++++++++++++++++++++ .github/workflows/fedora-copr-build.yml | 17 ++++----------- 3 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 .github/actions/setup-copr-cli/action.yml diff --git a/.github/actions/promote-snapshot/action.yml b/.github/actions/promote-snapshot/action.yml index e1b417ad..e2e2bf18 100644 --- a/.github/actions/promote-snapshot/action.yml +++ b/.github/actions/promote-snapshot/action.yml @@ -22,20 +22,9 @@ inputs: runs: using: "composite" steps: - - name: Setup Copr config file - shell: bash -e {0} - env: - # You need to have those secrets in your repo. - # See also: https://copr.fedorainfracloud.org/api/. - COPR_CONFIG_FILE: ${{ secrets.copr-config }} - run: | - mkdir -p ~/.config - printf "$COPR_CONFIG_FILE" > ~/.config/copr - - name: Install Copr CLI and required tools - shell: bash -e {0} - run: | - dnf install -y copr-cli make bzip2 rpm-build pcre2-tools jq - - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-copr-cli + with: + copr-config: ${{ secrets.copr-config }} - name: "Check if source project exists and all builds succeeded" shell: bash -e {0} run: | diff --git a/.github/actions/setup-copr-cli/action.yml b/.github/actions/setup-copr-cli/action.yml new file mode 100644 index 00000000..8a3bf178 --- /dev/null +++ b/.github/actions/setup-copr-cli/action.yml @@ -0,0 +1,24 @@ +# See https://docs.github.com/en/actions/creating-actions/creating-a-composite-action#creating-an-action-metadata-file + +name: "Setup copr" +description: "Installs Copr CLI and required tools" +inputs: + copr-config: + description: "The secret copr configuration found here https://copr.fedorainfracloud.org/api/" + required: true +runs: + using: "composite" + steps: + - name: Setup Copr config file + shell: bash -e {0} + env: + # You need to have those secrets in your repo. + # See also: https://copr.fedorainfracloud.org/api/. + COPR_CONFIG_FILE: ${{ secrets.copr-config }} + run: | + mkdir -p ~/.config + printf "$COPR_CONFIG_FILE" > ~/.config/copr + - name: Install Copr CLI and required tools + shell: bash -e {0} + run: | + dnf install -y copr-cli make bzip2 rpm-build pcre2-tools jq diff --git a/.github/workflows/fedora-copr-build.yml b/.github/workflows/fedora-copr-build.yml index ac82d0bf..9c7674b7 100644 --- a/.github/workflows/fedora-copr-build.yml +++ b/.github/workflows/fedora-copr-build.yml @@ -38,21 +38,12 @@ jobs: runs-on: ubuntu-latest container: fedora:38 steps: - - name: Setup Copr config file - env: - # You need to have those secrets in your repo. - # See also: https://copr.fedorainfracloud.org/api/. - COPR_CONFIG_FILE: ${{ secrets.COPR_CONFIG }} - run: | - mkdir -p ~/.config - printf "$COPR_CONFIG_FILE" > ~/.config/copr - - - name: Install Copr CLI and required tools - run: | - dnf install -y copr-cli make bzip2 rpm-build pcre2-tools jq - - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-copr-cli + with: + copr-config: ${{ secrets.COPR_CONFIG }} + - name: "Variables and functions" shell: bash -e {0} run: |