-
Notifications
You must be signed in to change notification settings - Fork 3
Added a deployment step to github actions #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,68 @@ | ||||||
| name: Deploy | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: [master] | ||||||
|
|
||||||
| # GITHUB_TOKEN needs write access to push the image to GHCR. | ||||||
| permissions: | ||||||
| contents: read | ||||||
| packages: write | ||||||
|
|
||||||
| jobs: | ||||||
| deploy: | ||||||
| name: Build, Push & Deploy | ||||||
| runs-on: ubuntu-latest | ||||||
| # Scoping to a GitHub environment lets you add approval gates and | ||||||
| # view deployment history in the GitHub UI (Settings > Environments). | ||||||
| environment: production | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Log in to GitHub Container Registry | ||||||
| uses: docker/login-action@v3 | ||||||
| with: | ||||||
| registry: ghcr.io | ||||||
| username: ${{ github.actor }} | ||||||
| password: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
|
||||||
| - name: Build and push Docker image | ||||||
| uses: docker/build-push-action@v6 | ||||||
| with: | ||||||
| context: . | ||||||
| file: packages/backend/Dockerfile | ||||||
| push: true | ||||||
| # Always push :latest so the Linode deploy script can reference a stable tag. | ||||||
| # The SHA tag gives you an immutable rollback point. | ||||||
| tags: | | ||||||
| ghcr.io/${{ github.repository_owner }}/muzzle:latest | ||||||
| ghcr.io/${{ github.repository_owner }}/muzzle:${{ github.sha }} | ||||||
|
|
||||||
| - name: Deploy to Linode | ||||||
| uses: appleboy/ssh-action@v1 | ||||||
| # The env block sets these variables on the runner, and `envs` passes | ||||||
| # them through to the remote shell — keeping the token off the command | ||||||
| # line and out of the remote process list. | ||||||
| env: | ||||||
| GHCR_TOKEN: ${{ secrets.GHCR_PAT }} | ||||||
| GHCR_USER: ${{ github.actor }} | ||||||
|
||||||
| GHCR_USER: ${{ github.actor }} | |
| GHCR_USER: ${{ github.repository_owner }} |
Copilot
AI
Mar 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow authenticates to the Linode host using an SSH password (LINODE_PASSWORD). Prefer key-based SSH authentication (with key/key_path) to reduce the risk of credential exposure and to align with common hardening practices for production deployment access.
| password: ${{ secrets.LINODE_PASSWORD }} | |
| key: ${{ secrets.LINODE_SSH_KEY }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploys can run concurrently if multiple commits are pushed close together, which risks pulling/starting different images out of order on the Linode host. Add a
concurrencygroup (e.g., workflow-level or job-level) to serialize production deployments and optionally cancel in-progress runs when a newer commit is pushed.