-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Showing
7 changed files
with
164 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Deploy | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Docker"] | ||
branches: | ||
- master | ||
types: | ||
- completed | ||
|
||
jobs: | ||
determine-image: | ||
if: github.event.workflow_run.conclusion == 'success' | ||
name: Determine image to use | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
tag: ${{ steps.sha_tag.outputs.tag }} | ||
steps: | ||
- name: Create SHA Container Tag | ||
id: sha_tag | ||
run: | | ||
[[ "${{ github.ref }}" != "refs/tags/"* ]] && tag=sha-$(cut -c 1-7 <<< $GITHUB_SHA) | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && tag=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
echo "::set-output name=tag::$tag" | ||
prod-deploy: | ||
environment: production | ||
needs: determine-image | ||
if: ${{ !startsWith(needs.determine-image.outputs.tag, 'sha-') }} | ||
name: Deploy to production | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- run: echo "deploying to production with tag ${{ needs.determine-image.outputs.tag }}" | ||
- name: Authenticate with Kubernetes | ||
uses: azure/k8s-set-context@v1 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBECONFIG }} | ||
|
||
- name: Deploy to Kubernetes | ||
uses: Azure/k8s-deploy@v1 | ||
with: | ||
manifests: | | ||
manifests/deployment.yaml | ||
images: 'ghcr.io/thesharks/wildbeast:${{ needs.determine-image.outputs.tag }}' | ||
kubectl-version: 'latest' | ||
namespace: wildbeast-staging | ||
|
||
staging-deploy: | ||
environment: staging | ||
needs: determine-image | ||
if: ${{ startsWith(needs.determine-image.outputs.tag, 'sha-') }} | ||
name: Deploy to staging | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- run: echo "deploying to staging with tag ${{ needs.determine-image.outputs.tag }}" | ||
- name: Authenticate with Kubernetes | ||
uses: azure/k8s-set-context@v1 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBECONFIG }} | ||
|
||
- name: Deploy to Kubernetes | ||
uses: Azure/k8s-deploy@v1 | ||
with: | ||
manifests: | | ||
bot/deployment.yaml | ||
images: 'ghcr.io/thesharks/wildbeast:${{ needs.determine-image.outputs.tag }}' | ||
kubectl-version: 'latest' | ||
namespace: wildbeast-production |
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 |
---|---|---|
|
@@ -13,9 +13,7 @@ on: | |
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x] | ||
|
@@ -31,3 +29,12 @@ jobs: | |
- run: npm test | ||
env: | ||
CI: true | ||
automerge: | ||
needs: build | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: fastify/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
target: minor |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: wildbeast | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: wildbeast | ||
template: | ||
metadata: | ||
labels: | ||
app: wildbeast | ||
spec: | ||
containers: | ||
- name: wildbeast | ||
image: ghcr.io/thesharks/wildbeast:edge | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
memory: "600Mi" | ||
cpu: "750m" | ||
limits: | ||
memory: "800Mi" | ||
cpu: "1000m" | ||
envFrom: | ||
- secretRef: | ||
name: bot-env | ||
- secretRef: | ||
name: sentry-env | ||
- secretRef: | ||
name: db-credentials | ||
|
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: bot-env | ||
type: Opaque | ||
data: | ||
BOT_TOKEN: <Replace me> | ||
BOT_PREFIX: ++ | ||
INVIDIOUS_HOST: <Pick a server from https://invidio.us> | ||
LAVALINK_DISCOVERY: | | ||
'{"hostname":"lavalink.lavalink.svc.cluster.local", "port": 2333,"password":"youshallnotpass"}' | ||
--- | ||
|
||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: sentry-env | ||
type: Opaque | ||
data: | ||
SENTRY_DSN: https://ingest.sentry.io | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: db-credentials | ||
type: Opaque | ||
data: | ||
# Depending on the driver you're using, enter your credentials here | ||
# Typically, drivers consist of a host, username, and a password | ||
# but this can differ between drivers, check your driver's documentation | ||
DB_HOST: <Host> | ||
DB_USER: <User> | ||
DB_PASSWORD: <Password> |