This commit is contained in:
+13
-12
@@ -25,17 +25,18 @@ jobs:
|
|||||||
run: npm test
|
run: npm test
|
||||||
- name: Production build
|
- name: Production build
|
||||||
run: npm run 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'
|
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: |
|
run: |
|
||||||
if [ -z "$STUDIO_PASSWORD" ]; then
|
node --input-type=module <<'JS'
|
||||||
echo "Deployment skipped: repository secret STUDIO_PASSWORD is not configured"
|
import Docker from "dockerode";
|
||||||
exit 0
|
const docker = new Docker({ socketPath: "/var/run/docker.sock" });
|
||||||
fi
|
for (const name of ["rednote-tool-studio", "rednote-tool-studio-candidate", "rednote-tool-studio-previous"]) {
|
||||||
node scripts/deploy.mjs
|
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