-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This also removes deprecated set-output calls
- Loading branch information
1 parent
846e47b
commit 3ec6591
Showing
4 changed files
with
128 additions
and
99 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,65 @@ | ||
name: Build & Deploy | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sha-tag: | ||
description: "A short-form SHA tag for the commit that triggered this workflow" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
name: Build & Push Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- 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: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
cache-from: type=registry,ref=ghcr.io/python-discord/quackstack:main | ||
cache-to: type=inline | ||
tags: | | ||
ghcr.io/python-discord/quackstack:main | ||
ghcr.io/python-discord/quackstack:${{ inputs.sha-tag }} | ||
deploy: | ||
name: Deploy to Kubernetes | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
steps: | ||
- name: Checkout infra repo for deployment manifest | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: python-discord/infra | ||
path: infra | ||
|
||
- uses: azure/setup-kubectl@v3 | ||
|
||
- name: Authenticate with Kubernetes | ||
uses: azure/k8s-set-context@v3 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBECONFIG }} | ||
|
||
- name: Deploy to Kubernetes | ||
uses: azure/k8s-deploy@v4 | ||
with: | ||
manifests: | | ||
infra/kubernetes/namespaces/default/quackstack/deployment.yaml | ||
images: 'ghcr.io/python-discord/quackstack:${{ inputs.sha-tag }}' |
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,23 @@ | ||
name: Lint | ||
|
||
on: | ||
workflow_call | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python Dependencies | ||
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.1 | ||
with: | ||
python_version: '3.10' | ||
|
||
- name: Run pre-commit hooks | ||
run: SKIP=ruff pre-commit run --all-files | ||
|
||
# Run `ruff` using github formatting to enable automatic inline annotations. | ||
- name: Run ruff | ||
run: "ruff check --format=github ." |
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,40 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
|
||
lint-test: | ||
uses: ./.github/workflows/lint.yml | ||
|
||
generate-sha-tag: | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
sha-tag: ${{ steps.sha-tag.outputs.sha-tag }} | ||
steps: | ||
- name: Create SHA Container tag | ||
id: sha-tag | ||
run: | | ||
tag=$(cut -c 1-7 <<< $GITHUB_SHA) | ||
echo "sha-tag=$tag" >> $GITHUB_OUTPUT | ||
build-deploy: | ||
uses: ./.github/workflows/build-deploy.yml | ||
needs: | ||
- lint-test | ||
- generate-sha-tag | ||
with: | ||
sha-tag: ${{ needs.generate-sha-tag.outputs.sha-tag }} | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.