Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions deploy-to-kubernetes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Deploy to Kubernetes'
description: 'Deploy application to a Kubernetes Cluster. Requires Kubernetes to be configured first.'
Comment thread
SirCotare marked this conversation as resolved.
Outdated

inputs:
environment:
description: '"test" or "prod"'
namespace-name:
description: 'Digital Ocean namespace name'
deployment-name:
description: 'Kubernetes deployment name'
Comment thread
SirCotare marked this conversation as resolved.

runs:
using: "composite"
steps:
- name: Deploy to Kubernetes
run: kubectl apply -f infrastructure/kubernetes.${{ inputs.environment }}.yml
shell: bash

- name: Verify deployment
id: verify
run: kubectl rollout status -n ${{ inputs.namespace-name }} deployment/${{ inputs.deployment-name }}
shell: bash

- name: Undo deployment if failed
if: ${{ failure() && steps.verify.conclusion == 'failure' }}
run: kubectl rollout undo -n ${{ inputs.namespace-name }} deployment/${{ inputs.deployment-name }}
shell: bash
7 changes: 7 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright About Bits GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 changes: 22 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
# GitHub Actions Kubernetes

A collection of GitHub actions for Kubernetes projects.
A collection of GitHub actions for Kubernetes.

## Example Playbook
## Setup DigitalOcean
Setup Digital-Ocean CLI and configure Kubernetes.
Comment thread
SirCotare marked this conversation as resolved.
Outdated

### Example

```yaml
- uses: aboutbits/github-actions-kubernetes/setup-digital-ocean@v1
Comment thread
SirCotare marked this conversation as resolved.
Outdated
with:
cluster-name: ${{ env.TEST_CLUSTER_NAME }}
digital-ocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }}
Comment thread
SirCotare marked this conversation as resolved.
Outdated
```

## Deploy to Kubernetes
Deploy application to a Kubernetes Cluster. Requires Kubernetes to be configured first.
Comment thread
SirCotare marked this conversation as resolved.
Outdated

### Example

```yaml
- name: Build code
uses: aboutbits/github-actions-kubernetes/xxx@v1
- uses: aboutbits/github-actions-kubernetes/deploy-to-kubernetes@v1
Comment thread
SirCotare marked this conversation as resolved.
Outdated
with:
xxx-version: ${{ env.NODE_VERSION }}
environment: 'test'
Comment thread
SirCotare marked this conversation as resolved.
Outdated
namespace-name: ${{ env.NAMESPACE_NAME }}
deployment-name: ${{ env.DEPLOYMENT_NAME }}
```

## Versioning

In order to have a verioning in place and working, create leightweight tags that point to the appropriate minor release versions.
In order to have a versioning in place and working, create lightweight tags that point to the appropriate minor release versions.

Creating a new minor release:

Expand Down
20 changes: 20 additions & 0 deletions setup-digital-ocean/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Setup Kubernetes for Digital-Ocean.'
description: 'Setup Digital-Ocean CLI and configure Kubernetes.'
Comment thread
SirCotare marked this conversation as resolved.
Outdated

inputs:
cluster-name:
description: 'Kubernetes cluster name'
digital-ocean-token:
description: 'Digital Ocean access token'

runs:
using: "composite"
steps:
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ inputs.digital-ocean-token }}

- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ inputs.cluster-name }}
shell: bash
11 changes: 0 additions & 11 deletions xxx/action.yml

This file was deleted.