This commit is contained in:
+13
-12
@@ -25,17 +25,18 @@ jobs:
|
||||
run: npm test
|
||||
- name: Production build
|
||||
run: npm run build
|
||||
- name: Deploy production container
|
||||
- name: Stop the retired persistent container
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
||||
env:
|
||||
STUDIO_USERNAME: studio
|
||||
STUDIO_PASSWORD: ${{ secrets.STUDIO_PASSWORD }}
|
||||
DEPLOY_PORT: ${{ vars.DEPLOY_PORT }}
|
||||
DEPLOY_DOCKERFILE: Dockerfile.deploy
|
||||
GITHUB_SHA: ${{ gitea.sha }}
|
||||
run: |
|
||||
if [ -z "$STUDIO_PASSWORD" ]; then
|
||||
echo "Deployment skipped: repository secret STUDIO_PASSWORD is not configured"
|
||||
exit 0
|
||||
fi
|
||||
node scripts/deploy.mjs
|
||||
node --input-type=module <<'JS'
|
||||
import Docker from "dockerode";
|
||||
const docker = new Docker({ socketPath: "/var/run/docker.sock" });
|
||||
for (const name of ["rednote-tool-studio", "rednote-tool-studio-candidate", "rednote-tool-studio-previous"]) {
|
||||
try {
|
||||
await docker.getContainer(name).remove({ force: true });
|
||||
} catch (error) {
|
||||
if (error.statusCode !== 404) throw error;
|
||||
}
|
||||
}
|
||||
console.log("Retired Rednote Tool Studio containers stopped; the data volume was preserved.");
|
||||
JS
|
||||
|
||||
Reference in New Issue
Block a user