Skip to content

Feature/init v1 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
34 changes: 34 additions & 0 deletions deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Deploy to Kubernetes'
description: 'Deploy an application to a Kubernetes cluster'

inputs:
working-directory:
description: 'The working directory'
default: '.'
deployment-file:
description: 'Deployment file for kubectl to apply'
required: true
namespace-name:
description: 'Kubernetes namespace name'
required: true
deployment-name:
description: 'Kubernetes deployment name'
required: true

runs:
using: "composite"
steps:
- name: Deploy to Kubernetes
working-directory: ${{ inputs.working-directory }}
run: kubectl apply -f ${{ inputs.deployment-file }}
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
22 changes: 22 additions & 0 deletions do-setup-kubectl/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Setup kubectl for DigitalOcean.'
description: 'Setup DigitalOcean CLI and configure kubectl'

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

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
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.
54 changes: 48 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,61 @@
# GitHub Actions Kubernetes

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

## Example Playbook
## Actions

### Setup DigitalOcean

Setup Digital-Ocean CLI and configure Kubernetes.

#### Example

```yaml
- uses: aboutbits/github-actions-kubernetes/do-setup-kubectl@v1
with:
digital-ocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }}
cluster-name: ${{ env.CLUSTER_NAME }}
```

#### Inputs

The following inputs can be used as `step.with` keys:

| Name | Required/Default | Description |
|--------------------------|--------------------|---------------------------------|
| `digital-ocean-token` | required | Digital Ocean access token |
| `cluster-name` | required | Kubernetes cluster name |


### Deploy to Kubernetes

Deploy application to a Kubernetes Cluster. Requires Kubernetes to be configured first.

#### Example

```yaml
- name: Build code
uses: aboutbits/github-actions-kubernetes/xxx@v1
- uses: aboutbits/github-actions-kubernetes/deploy@v1
with:
xxx-version: ${{ env.NODE_VERSION }}
deployment-file: 'infrastructure/kubernetes.prod.yml'
namespace-name: ${{ env.NAMESPACE_NAME }}
deployment-name: ${{ env.DEPLOYMENT_NAME }}
```

#### Inputs

The following inputs can be used as `step.with` keys:

| Name | Required/Default | Description |
|------------------------|----------------------|--------------------------------------------|
| `deployment-file` | required | Deployment file for kubectl to apply |
| `namespace-name` | required | Kubernetes namespace name |
| `deployment-name` | required | Kubernetes deployment name |
| `working-directory` | `.` | The working directory |


## 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
11 changes: 0 additions & 11 deletions xxx/action.yml

This file was deleted.