From ab0687edf1f5cda2d1dc190222a5a39339c20e2e Mon Sep 17 00:00:00 2001 From: saltiyazan Date: Fri, 5 Jan 2024 15:54:26 +0100 Subject: [PATCH] feat: Adds update libs workflow (#25) --- .github/workflows/update-libs.yaml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/update-libs.yaml diff --git a/.github/workflows/update-libs.yaml b/.github/workflows/update-libs.yaml new file mode 100644 index 0000000..7b097d6 --- /dev/null +++ b/.github/workflows/update-libs.yaml @@ -0,0 +1,54 @@ +name: Auto-update Charm Libraries +on: + workflow_dispatch: + schedule: + - cron: "0 0,12 * * *" + +permissions: + contents: write + pull-requests: write + +jobs: + update-lib: + name: Check libraries + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up SSH Key for Signing Commits + run: | + mkdir -p ~/.ssh + echo "${{ secrets.BOT_PRIVATE_SIGNING_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "${{ secrets.BOT_PUBLIC_SIGNING_KEY }}" > ~/.ssh/id_rsa.pub + chmod 644 ~/.ssh/id_rsa.pub + git config --global user.email "telco-engineers@lists.canonical.com" + git config --global user.name "telcobot" + git config --global user.signingkey ~/.ssh/id_rsa.pub + git config --global commit.gpgsign true + git config --global gpg.format ssh + + - name: Fetch charm libraries + run: | + sudo snap install charmcraft --classic --channel latest/stable + charmcraft fetch-lib + env: + CHARMCRAFT_AUTH: "${{ secrets.CHARMCRAFT_AUTH }}" + + - name: Create a PR for local changes + uses: peter-evans/create-pull-request@v5.0.2 + with: + token: ${{ secrets.TELCO_GITHUB_BOT_TOKEN }} + commit-message: "chore: update charm libraries" + committer: "Telcobot " + author: "Telcobot " + title: "chore: Update charm libraries" + body: | + Automated action to fetch latest version of charm libraries. The branch of this PR + will be wiped during the next check. Unless you really know what you're doing, you + most likely don't want to push any commits to this branch. + branch: "chore/auto-libs" + delete-branch: true