Skip to content

Commit

Permalink
Merge pull request #1280 from podverse/develop
Browse files Browse the repository at this point in the history
Upgrade github action docker handling
  • Loading branch information
mitchdowney authored May 29, 2024
2 parents c3c1c15 + 577c41c commit 9ff081a
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ on:
push:
branches: [ master ]

env:
REGISTRY: podverse
IMAGE_NAME: podverse_web

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Read node from package.json
uses: culshaw/read-package-node-version-actions@v1
Expand All @@ -23,36 +27,17 @@ jobs:
message: "Deploying podverse-web ${{ steps.package-node-version.outputs.version }} to prod..."
server: ${{ secrets.MATRIX_SERVER }}

- name: build and push docker image
uses: docker/build-push-action@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: podverse/podverse_web
tags: latest,${{ steps.package-node-version.outputs.version }}

- name: Tailscale
uses: tailscale/github-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}

- name: log into prod, then deploy latest prod image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USERNAME }}
key: ${{ secrets.PROD_SSH_PRIVATE_KEY }}
command_timeout: 60m
script: |
docker stop podverse_web_prod
docker rm podverse_web_prod
docker image rm podverse/podverse_web:latest
docker compose -f /opt/podverse-ops/docker-compose/prod/srv/docker-compose.yml up --quiet-pull -d podverse_web
- name: send deploy finished message to Matrix Alerts room
uses: s3krit/[email protected]
- name: build and push docker image
id: push
uses: docker/build-push-action@v5
with:
room_id: ${{ secrets.MATRIX_ALERTS_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "podverse-web ${{ steps.package-node-version.outputs.version }} has finished deploying to prod 🎉"
server: ${{ secrets.MATRIX_SERVER }}
context: .
push: true
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: latest,${{ steps.package-node-version.outputs.version }}

0 comments on commit 9ff081a

Please sign in to comment.