Skip to content

Commit

Permalink
Merge branch 'appleboy:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
GammaGames authored Oct 23, 2024
2 parents aed7361 + 8b84eae commit 5b73b09
Show file tree
Hide file tree
Showing 8 changed files with 505 additions and 38 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Goreleaser

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: "^1"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 15 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ jobs:
username: linuxserver.io
password: password
port: 2222
script: whoami
script: |
#!/usr/bin/env bash
set -e
whoami
check-ssh-key:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -459,6 +462,16 @@ jobs:
echo "$GITHUB_BASE_REF"
echo "$GITHUB_REF"
- name: pass secret variable in shell
uses: ./
continue-on-error: true
with:
host: ${{ env.REMOTE_HOST }}
username: linuxserver.io
key: ${{ env.PRIVATE_KEY }}
port: 2222
script: cd ${{ secrets.PORT }}

- name: switch to root user
uses: ./
with:
Expand Down Expand Up @@ -491,6 +504,7 @@ jobs:
- name: testing ipv6
uses: ./
continue-on-error: true
with:
host: 2402:1f00:8000:800::2628
username: ubuntu
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ jobs:
username: linuxserver.io
password: password
port: 2222
script: whoami
script: |
#!/usr/bin/env bash
set -e
whoami
check-ssh-key:
runs-on: ubuntu-latest
Expand Down
28 changes: 28 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
builds:
- # If true, skip the build.
# Useful for library projects.
# Default is false
skip: true

changelog:
use: github
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: "Enhancements"
regexp: "^.*chore[(\\w)]*:+.*$"
order: 2
- title: "Refactor"
regexp: "^.*refactor[(\\w)]*:+.*$"
order: 3
- title: "Build process updates"
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
order: 4
- title: "Documentation updates"
regexp: ^.*?docs?(\(.+\))??!?:.+$
order: 4
- title: Others
5 changes: 0 additions & 5 deletions Dockerfile

This file was deleted.

33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 🚀 SSH for GitHub Actions

[繁體中文](./README.zh-tw.md)
[简体中文](./README.zh-cn.md)

[GitHub Action](https://github.com/features/actions) for executing remote ssh commands.

Expand All @@ -17,7 +18,7 @@ This thing is built using [Golang](https://go.dev) and [drone-ssh](https://githu
See [action.yml](./action.yml) for more detailed information.

| Input Parameter | Description | Default Value |
|---------------------------|------------------------------------------------------------------------------------------|---------------|
| ------------------------- | ---------------------------------------------------------------------------------------- | ------------- |
| host | SSH host address | |
| port | SSH port number | 22 |
| passphrase | SSH key passphrase | |
Expand Down Expand Up @@ -65,7 +66,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand All @@ -81,9 +82,9 @@ output:
whoami
======END======
out: ***
==============================================
✅ Successfully executed commands to all host.
==============================================
===============================================
✅ Successfully executed commands to all hosts.
===============================================
```

### Setting up a SSH Key
Expand Down Expand Up @@ -181,7 +182,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"

```yaml
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand All @@ -194,7 +195,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
```yaml
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand All @@ -207,7 +208,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
```yaml
- name: multiple command
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand All @@ -224,7 +225,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
```diff
- name: multiple host
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
- host: "foo.com"
+ host: "foo.com,bar.com"
Expand All @@ -242,7 +243,7 @@ The default value of `port` is `22`.

```diff
- name: multiple host
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
- host: "foo.com"
+ host: "foo.com:1234,bar.com:5678"
Expand All @@ -257,7 +258,7 @@ The default value of `port` is `22`.

```diff
- name: multiple host
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: "foo.com,bar.com"
+ sync: true
Expand All @@ -273,7 +274,7 @@ The default value of `port` is `22`.

```diff
- name: pass environment
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
+ env:
+ FOO: "BAR"
+ BAR: "FOO"
Expand All @@ -298,7 +299,7 @@ _Inside `env` object, you need to pass every environment variable as a string, p

```diff
- name: stop script if command error
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand Down Expand Up @@ -351,7 +352,7 @@ Host FooServer

```diff
- name: ssh proxy command
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand All @@ -374,7 +375,7 @@ It is not uncommon for files to leak from backups or decommissioned hardware, an

```diff
- name: ssh key passphrase
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand All @@ -400,7 +401,7 @@ Now you can adjust you config:

```diff
- name: ssh key passphrase
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
Expand Down
Loading

0 comments on commit 5b73b09

Please sign in to comment.