-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9271d13
commit 8ba9b66
Showing
2 changed files
with
25 additions
and
58 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,35 @@ | ||
name: "Docker CI" | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
name: "Docker CI/CD" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: pluto-betting-bot | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build-and-push: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download Swagger Specification | ||
run: | | ||
curl -o Khronos-Swagger-Spec-v1.json ${{ secrets.SWAGGER_SPEC_URL }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Download assets | ||
run: | | ||
docker pull ghcr.io/${{ github.repository_owner }}/pluto-assets:latest | ||
docker create --name temp ghcr.io/${{ github.repository_owner }}/pluto-assets:latest | ||
docker cp temp:/assets/. ./assets/ | ||
docker rm temp | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6.9.0 | ||
- name: Deploy to VPS | ||
uses: appleboy/ssh-action@master | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
DOTENV_KEY=${{ secrets.DOTENV_KEY }} | ||
R_HOST=${{ secrets.R_HOST }} | ||
network: | | ||
${{ secrets.NETWORK_1 }} | ||
${{ secrets.NETWORK_2 }} | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEYFILE }} | ||
password: ${{ secrets.SSH_PASS }} | ||
script: | | ||
cd apps/Pluto-Betting-Bot | ||
git pull origin main | ||
# Download the latest Swagger spec | ||
curl -o Khronos-Swagger-Spec-v1.json '${{ secrets.SWAGGER_SPEC_URL }}' | ||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
docker pull ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest | ||
docker-compose down | ||
docker-compose up -d |
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