Skip to content

Commit

Permalink
remove libpurple-oscar, test automated ci
Browse files Browse the repository at this point in the history
  • Loading branch information
realies committed Oct 25, 2024
1 parent feba7d8 commit 31aa229
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 2 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/update-dependancies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Update Bitlbee Dependencies

on:
schedule:
- cron: '0 0 * * *' # Daily at 00:00 UTC
workflow_dispatch:
push:
branches:
- master

jobs:
check-and-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check dependencies for updates
id: check_deps
uses: actions/github-script@v7
with:
script: |
const deps = {
'BITLBEE': { owner: 'bitlbee', repo: 'bitlbee' },
'DISCORD': { owner: 'sm00th', repo: 'bitlbee-discord' },
'INSTAGRAM': { owner: 'EionRobb', repo: 'purple-instagram' },
'FACEBOOK': { owner: 'jgeboski', repo: 'bitlbee-facebook' },
'SKYPE': { owner: 'EionRobb', repo: 'skype4pidgin' },
'SLACK': { owner: 'dylex', repo: 'slack-libpurple' },
'STEAM': { owner: 'bitlbee', repo: 'bitlbee-steam' },
'TELEGRAM': { owner: 'majn', repo: 'telegram-purple' }
};
const fs = require('fs');
const dockerfile = fs.readFileSync('Dockerfile', 'utf8');
let updates = {};
let hasUpdates = false;
for (const [key, repo] of Object.entries(deps)) {
const result = await github.rest.repos.getBranch({
owner: repo.owner,
repo: repo.repo,
branch: 'master'
});
const latestCommit = result.data.commit.sha.substring(0, 7);
const currentCommit = dockerfile.match(new RegExp(`ENV ${key}_COMMIT ([a-f0-9]+)`))[1];
if (currentCommit !== latestCommit) {
updates[key] = {
current: currentCommit,
latest: latestCommit,
owner: repo.owner,
repo: repo.repo
};
hasUpdates = true;
}
}
core.setOutput('has_updates', hasUpdates);
core.setOutput('updates', JSON.stringify(updates));
- name: Update Dockerfile and README
if: steps.check_deps.outputs.has_updates == 'true'
run: |
UPDATES='${{ steps.check_deps.outputs.updates }}'
# Update Dockerfile
for key in $(echo $UPDATES | jq -r 'keys[]'); do
current=$(echo $UPDATES | jq -r ".[\"$key\"].current")
latest=$(echo $UPDATES | jq -r ".[\"$key\"].latest")
sed -i "s/ENV ${key}_COMMIT ${current}/ENV ${key}_COMMIT ${latest}/" Dockerfile
# Update README
owner=$(echo $UPDATES | jq -r ".[\"$key\"].owner")
repo=$(echo $UPDATES | jq -r ".[\"$key\"].repo")
full_sha=$(echo $UPDATES | jq -r ".[\"$key\"].latest")
sed -i "s|\[$current\](https://github.com/$owner/$repo/commit/[a-f0-9]\+)|\[$latest\](https://github.com/$owner/$repo/commit/$full_sha)|" README.md
done
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
if: steps.check_deps.outputs.has_updates == 'true'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: realies/bitlbee:latest
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
cache-from: type=registry,ref=realies/bitlbee:cache
cache-to: type=inline,mode=max,ref=realies/bitlbee:cache

- name: Commit changes if needed
if: steps.check_deps.outputs.has_updates == 'true'
run: |
git config user.email "${{ secrets.USER_EMAIL }}"
git config user.name "${{ secrets.USER_NAME }}"
git add Dockerfile README.md
git commit -m "update dependencies to latest commits"
git push
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ RUN apk add glib \
libgcrypt \
libpurple \
libpurple-bonjour \
libpurple-oscar \
libpurple-xmpp \
libwebp \
pidgin \
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Minimal build of latest BitlBee on latest Alpine with latest plugins
| [bitlbee-facebook](https://github.com/jgeboski/bitlbee-facebook) | facebook | 1.2.0 | [c76b36b](https://github.com/bitlbee/bitlbee-facebook/commit/c76b36bd29ee8b32fd038c7b7254931c71ecce1b) |
| [libpurple](https://pkgs.alpinelinux.org/package/edge/community/x86_64/libpurple) | gg, irc, novell, simple, zephyr | 2.13.0-r2 | [38d8a7c](http://git.alpinelinux.org/cgit/aports/commit/?id=38d8a7c2ca995bf1fc1c310303941fcad35ae429) |
| [libpurple-bonjour](https://pkgs.alpinelinux.org/package/edge/community/x86_64/libpurple-bonjour) | bonjour | 2.13.0-r2 | [38d8a7c](http://git.alpinelinux.org/cgit/aports/commit/?id=38d8a7c2ca995bf1fc1c310303941fcad35ae429) |
| [libpurple-oscar](https://pkgs.alpinelinux.org/package/edge/community/x86_64/libpurple-oscar) | aim, icq, oscar | 2.13.0-r2 | [38d8a7c](http://git.alpinelinux.org/cgit/aports/commit/?id=38d8a7c2ca995bf1fc1c310303941fcad35ae429) |
| [libpurple-xmpp](https://pkgs.alpinelinux.org/package/edge/community/x86_64/libpurple-xmpp) | jabber, xmpp | 2.13.0-r2 | [38d8a7c](http://git.alpinelinux.org/cgit/aports/commit/?id=38d8a7c2ca995bf1fc1c310303941fcad35ae429) |
| [purple-instagram](https://github.com/EionRobb/purple-instagram) | instagram | git-HEAD | [420cef4](https://github.com/EionRobb/purple-instagram/commit/420cef45db2398739ac19c93640e6fff42865bb1) |
| [skype4pidgin](https://github.com/EionRobb/skype4pidgin) | skype | 1.5 | [cf65095](https://github.com/EionRobb/skype4pidgin/commit/cf650950f937cf4faf834063128693a6c6a30a00) |
Expand Down

0 comments on commit 31aa229

Please sign in to comment.