Build #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
update: | |
name: Update | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update | |
run: | | |
#!/bin/bash | |
latestVersion="$(curl -q --fail 'https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest' | jq -r '.tag_name' -)" | |
if gh release view "$latestVersion" --repo "$GITHUB_REPOSITORY"; then | |
echo "VaultWarden Binary: Version already exists" | |
exit 0 | |
fi | |
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")" | |
docker cp "$id":/vaultwarden "$arch2/vaultwarden" | |
docker cp "$id":/web-vault "$arch2/web-vault" | |
docker rm -v "$id" | |
tar -cvf vaultwarden-"$arch2".tar.gz "$arch2/vaultwarden" "$arch2/web-vault" | |
done | |
gh release create "$latestVersion" --repo "$GITHUB_REPOSITORY" --notes "Update to [$latestVersion](https://github.com/dani-garcia/vaultwarden/releases/tag/$latestVersion)" *.tar.gz | |
env: | |
GH_TOKEN: ${{ github.token }} |