update theme #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push Docker Image | |
on: | |
push: | |
branches: | |
- traP | |
- traP-* | |
env: | |
IMAGE_NAME: ghost | |
jobs: | |
image: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set IMAGE_TAG env (non traP branch) | |
run: echo "IMAGE_TAG=${GITHUB_REF:11}" >> $GITHUB_ENV | |
if: github.ref != 'refs/heads/traP' | |
- name: Set IMAGE_TAG env (traP branch) | |
run: echo "IMAGE_TAG=latest" >> $GITHUB_ENV | |
if: github.ref == 'refs/heads/traP' | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: traptitech | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
tags: | | |
ghcr.io/traptitech/ghost:${{ env.IMAGE_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
provenance: false | |
deploy-staging: | |
name: Deploy staging | |
runs-on: ubuntu-latest | |
needs: [image] | |
steps: | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v1 | |
with: | |
private-key: ${{ secrets.STAGING_SSH_KEY }} | |
public-key: ${{ secrets.STAGING_SSH_KEY_PUBLIC }} | |
known-hosts: ${{ secrets.STAGING_KNOWN_HOSTS }} | |
- name: Deploy | |
run: ssh -o LogLevel=QUIET -t ${{ secrets.STAGING_DEPLOY_USER }}@${{ secrets.STAGING_DEPLOY_HOST }} "sudo sh /srv/ghost/deploy.sh" |