Skip to content

Commit 0b09e23

Browse files
authored
Enable nightly builds by getting latest release via API
Also some entyrpoint script updates behind the scenes
1 parent a43fcc3 commit 0b09e23

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

.github/workflows/docker-ci.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Docker CI
22

33
on:
44
# Disabled cronjobs first until we configured the change detection logic.
5-
#schedule:
6-
# - cron: '30 3 * * *'
5+
schedule:
6+
- cron: '30 3 * * *'
77
push:
88
branches:
99
- "*"
@@ -23,7 +23,6 @@ env:
2323
RHQCR_NAMESPACE: recaptime-dev/vaultwarden
2424
GITLAB_MAUDEV_NAMESPACE: recaptime-dev/infra/docker/vaultwarden
2525
GHCR_NAMESPACE: recaptime-dev/vaultwarden-docker
26-
DOCKERHUB_NAMESPACE: ajhalili2006 # TODO: Update this before I add Docker Hub login stuff.
2726

2827
jobs:
2928
docker-build:
@@ -83,7 +82,7 @@ jobs:
8382
dock.mau.dev/${{ env.GITLAB_MAUDEV_NAMESPACE }}
8483
labels: |
8584
org.opencontainers.image.vendor=RecapTime.dev
86-
org.opencontainers.image.authors=~ajhalili2006
85+
org.opencontainers.image.authors=Andrei Jiroh Halili
8786
org.opencontainers.image.title=RecapTime.dev's Vaultwarden Docker image
8887
org.opencontainers.image.description=Custom Vaultwarden image, as used by Recap Time Squad for their instance.
8988
tags: |
@@ -99,7 +98,23 @@ jobs:
9998
- name: Set up Docker Buildx
10099
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5
101100

102-
# TODO: Fetch latest release via GitHub API
101+
# Fetch latest release via GitHub GraphQL API
102+
# Note: Script generated with GitHub Copilot
103+
- name: Get latest release
104+
run: |
105+
# Run the GitHub CLI command and extract the tag name using jq
106+
tag_name=$(gh api graphql -f query='{
107+
repository(owner: "dani-garcia", name: "vaultwarden") {
108+
releases(first: 1) {
109+
nodes {
110+
tagName
111+
}
112+
}
113+
}
114+
}' --jq '.data.repository.releases.nodes[0].tagName')
115+
116+
# Set the tag name as a GitHub Actions output
117+
echo "VAULTWARDEN_RELEASE=$tag_name" >> $GITHUB_ENV
103118
104119
# Build and push Docker image with Buildx (don't push on PR)
105120
# https://github.com/docker/build-push-action
@@ -111,5 +126,5 @@ jobs:
111126
tags: ${{ steps.meta.outputs.tags }}
112127
labels: ${{ steps.meta.outputs.labels }}
113128
provenance: true
114-
#build-args: |
115-
# VAULTWARDEN_RELEASE=TODO
129+
build-args: |
130+
VAULTWARDEN_RELEASE=${{ env.VAULTWARDEN_RELEASE }}

src/usr/bin/vaultwarden-startup

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ if [[ "${I_REALLY_WANT_VOLATILE_STORAGE}" == "true" ]]; then
7777
elif [[ "${I_REALLY_WANT_VOLATILE_STORAGE}" != "true" ]] && [[ "${SAFETY_LOCK_CODE}" == "$(cat /etc/safety-lock/datadir/code.txt)" ]]; then
7878
echo "error: To avoid data loss, either setup an container volume for the data directory or"
7979
echo "error: set I_REALLY_WANT_VOLATILE_STORAGE to true, assuming you know what you're doing."
80-
echo "error: In meanwhile, use the following as to disarm the safety lock (this is a bit insecure, but we know it)"
81-
echo "error: until we worked on Docker volume detection in the startup script."
80+
echo "error: In meanwhile, use the following code below to disarm the safety lock (this is a bit insecure"
81+
echo "error: but we know it) error: until we worked on Docker volume detection in the startup script."
82+
echo "error: SAFETY_LOCK_CODE=$(cat /etc/safety-lock/datadir/code.txt)"
8283
exit 1
8384
fi
8485

0 commit comments

Comments
 (0)