Skip to content

Commit

Permalink
ci: deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
suphon-t committed Jul 15, 2023
1 parent 3908bf8 commit 515fdb8
Showing 1 changed file with 31 additions and 49 deletions.
80 changes: 31 additions & 49 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,45 @@
name: Deployment
name: ci

on:
push:
branches: [main]
workflow_dispatch:

permissions:
packages: write

concurrency:
group: deploy
cancel-in-progress: false
branches:
- 'main'

jobs:
deploy:
docker:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
steps:
- name: checkout
uses: actions/checkout@v3
- name: buildx
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: login
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx
- name: build
uses: docker/build-push-action@v3
username: ${{ github.actor }}
password: ${{ github.token }}
-
name: Build and push
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}-runtime
cache-from: type=local,src=/tmp/.buildx-cache
# mode=max to cache multi-layer stage
# https://github.com/moby/buildkit#--export-cache-options
# https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: publish
uses: deploys-app/deploys-action@v1
tags: ghcr.io/webmastercamp/${{ github.event.repository.name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max

-
name: Deploy
uses: WebmasterCamp/deploy-action@main
with:
project: ${{ secrets.DEPLOYS_NAME }}
location: gke.cluster-rcf2
name: ${{ github.event.repository.name }}-runtime
image: ghcr.io/${{ github.repository }}-runtime
minReplicas: 1
maxReplicas: 2
env:
DEPLOYS_AUTH_USER: ${{ secrets.DEPLOYS_AUTH_USER }}
DEPLOYS_AUTH_PASS: ${{ secrets.DEPLOYS_AUTH_PASS }}
- name: cache-modding
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
image: ghcr.io/webmastercamp/${{ github.event.repository.name }}@${{ steps.build-and-push.outputs.digest }}
port: 3000

0 comments on commit 515fdb8

Please sign in to comment.