Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91f29e07f4 | ||
|
|
efb34d6cb2 | ||
|
|
767276df48 | ||
|
|
2b874f780f | ||
|
|
716cfe229d | ||
|
|
e93dd2d865 | ||
|
|
9c4bb5002a | ||
|
|
560e7ff9e2 | ||
|
|
9685b6d613 | ||
|
|
c83ced7ece | ||
|
|
6e8a90cd56 |
6
.github/workflows/deploy.yaml
vendored
6
.github/workflows/deploy.yaml
vendored
@@ -15,9 +15,8 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Build latest dist/ folder
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
npm ci
|
||||
npm run build
|
||||
- name: Upload dist/ folder
|
||||
run: |
|
||||
git config --global user.email "<41898282+github-actions[bot]@users.noreply.github.com>"
|
||||
@@ -26,4 +25,5 @@ jobs:
|
||||
git add -f dist README.md LICENSE action.yaml
|
||||
git commit -m "chore: create ci release ($GITHUB_SHA)"
|
||||
git tag --force v1
|
||||
git tag --force $GITHUB_REF_NAME
|
||||
git push -f --tags origin deploy
|
||||
|
||||
5
.github/workflows/test.yaml
vendored
5
.github/workflows/test.yaml
vendored
@@ -13,9 +13,8 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Build latest dist/ folder
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
npm ci
|
||||
npm run build
|
||||
- name: Upload dist/ folder
|
||||
run: |
|
||||
git config --global user.email "<41898282+github-actions[bot]@users.noreply.github.com>"
|
||||
|
||||
32
README.md
32
README.md
@@ -12,7 +12,7 @@ To use this action, add the following step to your GitHub Action workflow:
|
||||
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
|
||||
```
|
||||
|
||||
Keep in mind that the action expects a base64 encoded string of your Kubernetes configuration. The simplest way to do that is to run `cat $HOME/.kube/config | base64` and save that output as an action secret.
|
||||
Keep in mind that the action expects a base64 encoded string of your Kubernetes configuration. The simplest way to do that is to run `cat $HOME/.kube/config | base64` and save that output as an action secret. It's additionally possible to generate a config file using the `aws` CLI for EKS or any other tools with other cloud providers.
|
||||
|
||||
It's also possible to specify the version of the [kubectl](https://kubernetes.io/docs/reference/kubectl/) CLI to use. The current default release used by this action is the latest version.
|
||||
|
||||
@@ -40,3 +40,33 @@ jobs:
|
||||
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
|
||||
- run: kubectl get pods
|
||||
```
|
||||
|
||||
Here's an example using AWS EKS:
|
||||
|
||||
```yaml
|
||||
name: Kubectl Action
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::123456789100:role/my-github-actions-role
|
||||
aws-region: us-east-2
|
||||
- name: Generate kubeconfig
|
||||
run: |
|
||||
{
|
||||
echo 'EKS_CREDS<<EOF'
|
||||
aws eks update-kubeconfig --region us-east-2 --name my-cluster --dry-run | base64
|
||||
echo EOF
|
||||
} >> $GITHUB_ENV
|
||||
- uses: tale/kubectl-action@v1
|
||||
with:
|
||||
base64-kube-config: ${{ env.EKS_CREDS }}
|
||||
- run: kubectl get pods
|
||||
```
|
||||
|
||||
@@ -13,6 +13,6 @@ inputs:
|
||||
description: A base64 encoded reference to your authorization file (~/.kube/config)
|
||||
required: true
|
||||
runs:
|
||||
using: node16
|
||||
using: node20
|
||||
main: dist/index.js
|
||||
post: dist/index.js
|
||||
|
||||
8564
package-lock.json
generated
Normal file
8564
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -1,22 +1,21 @@
|
||||
{
|
||||
"name": "kubectl-action",
|
||||
"version": "1.2.0",
|
||||
"version": "1.4.0",
|
||||
"scripts": {
|
||||
"dev": "ncc -smw --license licenses.txt build src/main.ts",
|
||||
"build": "ncc -sm --license licenses.txt build src/main.ts",
|
||||
"push": "np --no-cleanup --no-publish --no-tests --message 'chore: v%s'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"undici": "^5.22.1"
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/tool-cache": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.3.2",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.43.0",
|
||||
"@types/node": "^20.11.30",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-tale": "^1.0.16",
|
||||
"np": "^8.0.4",
|
||||
"typescript": "^5.1.6"
|
||||
"np": "^9.2.0",
|
||||
"typescript": "^5.4.2"
|
||||
}
|
||||
}
|
||||
|
||||
4137
pnpm-lock.yaml
generated
4137
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import { env, platform } from 'node:process'
|
||||
import { env, exit, platform } from 'node:process'
|
||||
|
||||
import { debug, getState, setFailed } from '@actions/core'
|
||||
import { setupKubeconfig } from 'login'
|
||||
@@ -7,6 +7,7 @@ import { teardown } from 'teardown'
|
||||
|
||||
if (env.RUNNER_OS === 'Windows' || platform === 'win32') {
|
||||
setFailed('kubectl-action does not support Windows')
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if (getState('kubectl-path')) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import { env } from 'node:process'
|
||||
|
||||
import { addPath, debug, getInput, setFailed } from '@actions/core'
|
||||
import { cacheFile, downloadTool, find } from '@actions/tool-cache'
|
||||
import { fetch } from 'undici'
|
||||
|
||||
export async function installKubectl() {
|
||||
debug('Running kubectl-action installKubectl()')
|
||||
|
||||
Reference in New Issue
Block a user