Run for every arch

This commit is contained in:
Melon 2024-05-13 22:58:52 +01:00
parent 1b7447312d
commit 2d889c7fda
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -4,6 +4,7 @@ on:
push: push:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
workflow_dispatch:
permissions: permissions:
contents: write contents: write
@ -19,14 +20,21 @@ jobs:
repo="1f349/vaultwarden-binary" repo="1f349/vaultwarden-binary"
latestVersion="$(curl -q --fail 'https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest' | jq -r '.tag_name' -)" latestVersion="$(curl -q --fail 'https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest' | jq -r '.tag_name' -)"
if gh release view "$latestVersion" --repo "$repo"; then if gh release view "$latestVersion" --repo "$repo"; then
echo "VaultWarden Binary: Version already exists"
exit 0 exit 0
fi fi
docker pull --platform linux/amd64 vaultwarden/server:"$latestVersion"
archArr=(linux/amd64 linux/arm64 linux/arm/v7 linux/arm/v6)
for arch in ${archArr[@]}; do
arch2="${arch//\//-}"
mkdir "$arch2"
docker pull --platform "$arch" vaultwarden/server:"$latestVersion"
id="$(docker create vaultwarden/server:"$latestVersion")" id="$(docker create vaultwarden/server:"$latestVersion")"
docker cp "$id":/vaultwarden vaultwarden docker cp "$id":/vaultwarden "$arch2/vaultwarden"
docker cp "$id":/web-vault web-vault docker cp "$id":/web-vault "$arch2/web-vault"
docker rm -v "$id" docker rm -v "$id"
tar -cvf vaultwarden.tar.gz vaultwarden web-vault tar -cvf vaultwarden-"$arch2".tar.gz "$arch2/vaultwarden" "$arch2/web-vault"
gh release create "v$latestVersion" --repo "$repo" --notes "Update to [$latestVersion](https://github.com/dani-garcia/vaultwarden/releases/tag/$latestVersion" vaultwarden.tar.gz done
gh release create "$latestVersion" --repo "$repo" --notes "Update to [$latestVersion](https://github.com/dani-garcia/vaultwarden/releases/tag/$latestVersion" *.tar.gz
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}