Update dischat sharp to latest version #26
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: main | |
# Controls when the action will run. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
DEPLOY_BRANCH: "refs/heads/main" | |
DOCKER_REGISTRY: ghcr.io | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Set build variables | |
id: build_vars | |
run: | | |
export IMAGE_NAME_WITH_REGISTRY=$DOCKER_REGISTRY/${{ github.actor }}/${{ secrets.CAPROVER_APP_NAME }} | |
echo "FULL_IMAGE_NAME=$IMAGE_NAME_WITH_REGISTRY:latest" >> $GITHUB_ENV | |
echo "deploy_branch=${{ env.DEPLOY_BRANCH }}" >> $GITHUB_OUTPUT | |
- name: Check output | |
run: echo ${{steps.build_vars.outputs.deploy_branch}} | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to GitHub Container Registry | |
if: ${{ steps.build_vars.outputs.deploy_branch == github.ref }} | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Bot Docker image | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ steps.build_vars.outputs.deploy_branch == github.ref }} | |
tags: ${{ env.FULL_IMAGE_NAME }} | |
file: ./src/DiscordBot.Service/Dockerfile | |
context: . | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max | |
- name: Deploy to caprover | |
if: ${{ success() && steps.build_vars.outputs.deploy_branch == github.ref }} | |
uses: caprover/[email protected] | |
with: | |
server: ${{ secrets.CAPROVER_HOST }} | |
app: ${{ secrets.CAPROVER_APP_NAME }} | |
token: '${{ secrets.CAPROVER_APP_TOKEN }}' | |
image: '${{ env.FULL_IMAGE_NAME }}' |