mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
add "if_key_exists" (#179)
* add "if_key_exists" * add test * fix flag * fix SSH connection commands * add test for if_key_exists=ignore * add test for if_key_exists=fail * add tests to Windows / macOS * update CHANGELOG * update badges * update README * fix README * update README * add tests for Docker containers
This commit is contained in:
parent
8053198ce5
commit
88fb14d113
15 changed files with 1308 additions and 445 deletions
199
.github/workflows/verify-on-container-centos.yml
vendored
199
.github/workflows/verify-on-container-centos.yml
vendored
|
@ -93,3 +93,202 @@ jobs:
|
||||||
run: ls -l /root/.ssh
|
run: ls -l /root/.ssh
|
||||||
- name: git clone through SSH
|
- name: git clone through SSH
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_replace-key_exists:
|
||||||
|
name: if_key_exists=replace / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- centos:7
|
||||||
|
- centos:8
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
yum install -y git openssh-clients
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # replaced
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_replace-key_doesnt_exist:
|
||||||
|
name: if_key_exists=replace / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- centos:7
|
||||||
|
- centos:8
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
yum install -y git openssh-clients
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_ignore-key_exists:
|
||||||
|
name: if_key_exists=ignore / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- centos:7
|
||||||
|
- centos:8
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
yum install -y git openssh-clients
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_ignore-key_doesnt_exist:
|
||||||
|
name: if_key_exists=ignore / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- centos:7
|
||||||
|
- centos:8
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
yum install -y git openssh-clients
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_fail-key_exists:
|
||||||
|
name: if_key_exists=fail / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- centos:7
|
||||||
|
- centos:8
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
yum install -y git openssh-clients
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
continue-on-error: true
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_fail-key_doesnt_exist:
|
||||||
|
name: if_key_exists=fail / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- centos:7
|
||||||
|
- centos:8
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
yum install -y git openssh-clients
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
211
.github/workflows/verify-on-container-ubuntu.yml
vendored
211
.github/workflows/verify-on-container-ubuntu.yml
vendored
|
@ -99,3 +99,214 @@ jobs:
|
||||||
run: ls -l /root/.ssh
|
run: ls -l /root/.ssh
|
||||||
- name: git clone through SSH
|
- name: git clone through SSH
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_replace-key_exists:
|
||||||
|
name: if_key_exists=replace / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- ubuntu:16.04
|
||||||
|
- ubuntu:18.04
|
||||||
|
- ubuntu:20.04
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install openssh-client git
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # replaced
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_replace-key_doesnt_exist:
|
||||||
|
name: if_key_exists=replace / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- ubuntu:16.04
|
||||||
|
- ubuntu:18.04
|
||||||
|
- ubuntu:20.04
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install openssh-client git
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_ignore-key_exists:
|
||||||
|
name: if_key_exists=ignore / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- ubuntu:16.04
|
||||||
|
- ubuntu:18.04
|
||||||
|
- ubuntu:20.04
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install openssh-client git
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_ignore-key_doesnt_exist:
|
||||||
|
name: if_key_exists=ignore / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- ubuntu:16.04
|
||||||
|
- ubuntu:18.04
|
||||||
|
- ubuntu:20.04
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install openssh-client git
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_fail-key_exists:
|
||||||
|
name: if_key_exists=fail / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- ubuntu:16.04
|
||||||
|
- ubuntu:18.04
|
||||||
|
- ubuntu:20.04
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install openssh-client git
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
continue-on-error: true
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_fail-key_doesnt_exist:
|
||||||
|
name: if_key_exists=fail / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
container:
|
||||||
|
- ubuntu:16.04
|
||||||
|
- ubuntu:18.04
|
||||||
|
- ubuntu:20.04
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install openssh-client git
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l /root/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
74
.github/workflows/verify-on-macos-1015.yml
vendored
74
.github/workflows/verify-on-macos-1015.yml
vendored
|
@ -1,74 +0,0 @@
|
||||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
|
||||||
|
|
||||||
name: macOS Catalina
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh-pem:
|
|
||||||
name: Connect to github.com (PEM format)
|
|
||||||
runs-on: macos-10.15
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-pkcs8:
|
|
||||||
name: Connect to github.com (PKCS8 format)
|
|
||||||
runs-on: macos-10.15
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-rfc4716:
|
|
||||||
name: Connect to github.com (RFC4716 format)
|
|
||||||
runs-on: macos-10.15
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-with-name:
|
|
||||||
name: Connect to github.com with name and config
|
|
||||||
runs-on: macos-10.15
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
name: ssh_key_name # optional
|
|
||||||
config: | # optional
|
|
||||||
Host github
|
|
||||||
Hostname github.com
|
|
||||||
User git
|
|
||||||
IdentityFile ~/.ssh/ssh_key_name
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone github:shimataro/ssh-key-action.git tmp
|
|
239
.github/workflows/verify-on-macos.yml
vendored
Normal file
239
.github/workflows/verify-on-macos.yml
vendored
Normal file
|
@ -0,0 +1,239 @@
|
||||||
|
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
||||||
|
|
||||||
|
name: macOS
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ssh-pem:
|
||||||
|
name: Connect to github.com (PEM format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-pkcs8:
|
||||||
|
name: Connect to github.com (PKCS8 format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-rfc4716:
|
||||||
|
name: Connect to github.com (RFC4716 format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-with-name:
|
||||||
|
name: Connect to github.com with name and config
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
name: ssh_key_name # optional
|
||||||
|
config: | # optional
|
||||||
|
Host github
|
||||||
|
Hostname github.com
|
||||||
|
User git
|
||||||
|
IdentityFile ~/.ssh/ssh_key_name
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone github:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_replace-key_exists:
|
||||||
|
name: if_key_exists=replace / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # replaced
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_replace-key_doesnt_exist:
|
||||||
|
name: if_key_exists=replace / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_ignore-key_exists:
|
||||||
|
name: if_key_exists=ignore / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_ignore-key_doesnt_exist:
|
||||||
|
name: if_key_exists=ignore / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_fail-key_exists:
|
||||||
|
name: if_key_exists=fail / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
continue-on-error: true
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_fail-key_doesnt_exist:
|
||||||
|
name: if_key_exists=fail / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-10.15
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
74
.github/workflows/verify-on-ubuntu-1604.yml
vendored
74
.github/workflows/verify-on-ubuntu-1604.yml
vendored
|
@ -1,74 +0,0 @@
|
||||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
|
||||||
|
|
||||||
name: Ubuntu 16.04
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh-pem:
|
|
||||||
name: Connect to github.com (PEM format)
|
|
||||||
runs-on: ubuntu-16.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-pkcs8:
|
|
||||||
name: Connect to github.com (PKCS8 format)
|
|
||||||
runs-on: ubuntu-16.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-rfc4716:
|
|
||||||
name: Connect to github.com (RFC4716 format)
|
|
||||||
runs-on: ubuntu-16.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-with-name:
|
|
||||||
name: Connect to github.com with name and config
|
|
||||||
runs-on: ubuntu-16.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
name: ssh_key_name # optional
|
|
||||||
config: | # optional
|
|
||||||
Host github
|
|
||||||
Hostname github.com
|
|
||||||
User git
|
|
||||||
IdentityFile ~/.ssh/ssh_key_name
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone github:shimataro/ssh-key-action.git tmp
|
|
74
.github/workflows/verify-on-ubuntu-1804.yml
vendored
74
.github/workflows/verify-on-ubuntu-1804.yml
vendored
|
@ -1,74 +0,0 @@
|
||||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
|
||||||
|
|
||||||
name: Ubuntu 18.04
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh-pem:
|
|
||||||
name: Connect to github.com (PEM format)
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-pkcs8:
|
|
||||||
name: Connect to github.com (PKCS8 format)
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-rfc4716:
|
|
||||||
name: Connect to github.com (RFC4716 format)
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-with-name:
|
|
||||||
name: Connect to github.com with name and config
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
name: ssh_key_name # optional
|
|
||||||
config: | # optional
|
|
||||||
Host github
|
|
||||||
Hostname github.com
|
|
||||||
User git
|
|
||||||
IdentityFile ~/.ssh/ssh_key_name
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone github:shimataro/ssh-key-action.git tmp
|
|
74
.github/workflows/verify-on-ubuntu-2004.yml
vendored
74
.github/workflows/verify-on-ubuntu-2004.yml
vendored
|
@ -1,74 +0,0 @@
|
||||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
|
||||||
|
|
||||||
name: Ubuntu 20.04
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh-pem:
|
|
||||||
name: Connect to github.com (PEM format)
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-pkcs8:
|
|
||||||
name: Connect to github.com (PKCS8 format)
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-rfc4716:
|
|
||||||
name: Connect to github.com (RFC4716 format)
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-with-name:
|
|
||||||
name: Connect to github.com with name and config
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
name: ssh_key_name # optional
|
|
||||||
config: | # optional
|
|
||||||
Host github
|
|
||||||
Hostname github.com
|
|
||||||
User git
|
|
||||||
IdentityFile ~/.ssh/ssh_key_name
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone github:shimataro/ssh-key-action.git tmp
|
|
259
.github/workflows/verify-on-ubuntu.yml
vendored
Normal file
259
.github/workflows/verify-on-ubuntu.yml
vendored
Normal file
|
@ -0,0 +1,259 @@
|
||||||
|
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
||||||
|
|
||||||
|
name: Ubuntu
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ssh-pem:
|
||||||
|
name: Connect to github.com (PEM format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-pkcs8:
|
||||||
|
name: Connect to github.com (PKCS8 format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-rfc4716:
|
||||||
|
name: Connect to github.com (RFC4716 format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-with-name:
|
||||||
|
name: Connect to github.com with name and config
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
name: ssh_key_name # optional
|
||||||
|
config: | # optional
|
||||||
|
Host github
|
||||||
|
Hostname github.com
|
||||||
|
User git
|
||||||
|
IdentityFile ~/.ssh/ssh_key_name
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone github:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_replace-key_exists:
|
||||||
|
name: if_key_exists=replace / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # replaced
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_replace-key_doesnt_exist:
|
||||||
|
name: if_key_exists=replace / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_ignore-key_exists:
|
||||||
|
name: if_key_exists=ignore / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_ignore-key_doesnt_exist:
|
||||||
|
name: if_key_exists=ignore / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_fail-key_exists:
|
||||||
|
name: if_key_exists=fail / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
continue-on-error: true
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_fail-key_doesnt_exist:
|
||||||
|
name: if_key_exists=fail / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-16.04
|
||||||
|
- ubuntu-18.04
|
||||||
|
- ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
@ -1,74 +0,0 @@
|
||||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
|
||||||
|
|
||||||
name: Windows Server 2019
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh-pem:
|
|
||||||
name: Connect to github.com (PEM format)
|
|
||||||
runs-on: windows-2019
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-pkcs8:
|
|
||||||
name: Connect to github.com (PKCS8 format)
|
|
||||||
runs-on: windows-2019
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-rfc4716:
|
|
||||||
name: Connect to github.com (RFC4716 format)
|
|
||||||
runs-on: windows-2019
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
- name: print created files
|
|
||||||
run: ls ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
||||||
ssh-with-name:
|
|
||||||
name: Connect to github.com with name and config
|
|
||||||
runs-on: windows-2019
|
|
||||||
steps:
|
|
||||||
- name: Checkout source codes
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install SSH key
|
|
||||||
uses: ./.
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.SSH_KEY_PEM }}
|
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
||||||
name: ssh_key_name # optional
|
|
||||||
config: | # optional
|
|
||||||
Host github
|
|
||||||
Hostname github.com
|
|
||||||
User git
|
|
||||||
IdentityFile ~/.ssh/ssh_key_name
|
|
||||||
- name: print created files
|
|
||||||
run: ls -l ~/.ssh
|
|
||||||
- name: git clone through SSH
|
|
||||||
run: git clone github:shimataro/ssh-key-action.git tmp
|
|
239
.github/workflows/verify-on-windows.yml
vendored
Normal file
239
.github/workflows/verify-on-windows.yml
vendored
Normal file
|
@ -0,0 +1,239 @@
|
||||||
|
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
||||||
|
|
||||||
|
name: Windows
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ssh-pem:
|
||||||
|
name: Connect to github.com (PEM format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-pkcs8:
|
||||||
|
name: Connect to github.com (PKCS8 format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PKCS8 }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-rfc4716:
|
||||||
|
name: Connect to github.com (RFC4716 format)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_RFC4716 }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: print created files
|
||||||
|
run: ls ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
ssh-with-name:
|
||||||
|
name: Connect to github.com with name and config
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
name: ssh_key_name # optional
|
||||||
|
config: | # optional
|
||||||
|
Host github
|
||||||
|
Hostname github.com
|
||||||
|
User git
|
||||||
|
IdentityFile ~/.ssh/ssh_key_name
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone github:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_replace-key_exists:
|
||||||
|
name: if_key_exists=replace / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # replaced
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_replace-key_doesnt_exist:
|
||||||
|
name: if_key_exists=replace / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: replace
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_ignore-key_exists:
|
||||||
|
name: if_key_exists=ignore / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_ignore-key_doesnt_exist:
|
||||||
|
name: if_key_exists=ignore / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: ignore
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
|
||||||
|
key_if_exists_fail-key_exists:
|
||||||
|
name: if_key_exists=fail / key exists
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (dummy)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: "dummy" # ignored
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
continue-on-error: true
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
||||||
|
key_if_exists_fail-key_doesnt_exist:
|
||||||
|
name: if_key_exists=fail / key doesn't exist
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-2019
|
||||||
|
steps:
|
||||||
|
- name: Checkout source codes
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install SSH key (replace)
|
||||||
|
uses: ./.
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.SSH_KEY_PEM }}
|
||||||
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
if_key_exists: fail
|
||||||
|
- name: print created files
|
||||||
|
run: ls -l ~/.ssh
|
||||||
|
- name: git clone through SSH
|
||||||
|
run: git clone git@github.com:shimataro/ssh-key-action.git tmp
|
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* `if_key_exists` parameter
|
||||||
|
|
||||||
## [2.2.0] - 2021-02-27
|
## [2.2.0] - 2021-02-27
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
33
README.md
33
README.md
|
@ -1,11 +1,9 @@
|
||||||
# Install SSH Key
|
# Install SSH Key
|
||||||
|
|
||||||
[![Build][image-build]][link-build]
|
[![Build][image-build]][link-build]
|
||||||
[![Windows Server 2019][image-verify-windows-2019]][link-verify-windows-2019]
|
[![Windows][image-verify-windows]][link-verify-windows]
|
||||||
[![macOS Catalina][image-verify-macos-1015]][link-verify-macos-1015]
|
[![macOS][image-verify-macos]][link-verify-macos]
|
||||||
[![Ubuntu 20.04][image-verify-ubuntu-2004]][link-verify-ubuntu-2004]
|
[![Ubuntu][image-verify-ubuntu]][link-verify-ubuntu]
|
||||||
[![Ubuntu 18.04][image-verify-ubuntu-1804]][link-verify-ubuntu-1804]
|
|
||||||
[![Ubuntu 16.04][image-verify-ubuntu-1604]][link-verify-ubuntu-1604]
|
|
||||||
[![Docker container (Ubuntu)][image-verify-docker-container-ubuntu]][link-verify-docker-container-ubuntu]
|
[![Docker container (Ubuntu)][image-verify-docker-container-ubuntu]][link-verify-docker-container-ubuntu]
|
||||||
[![Docker container (CentOS)][image-verify-docker-container-centos]][link-verify-docker-container-centos]
|
[![Docker container (CentOS)][image-verify-docker-container-centos]][link-verify-docker-container-centos]
|
||||||
[![Release][image-release]][link-release]
|
[![Release][image-release]][link-release]
|
||||||
|
@ -38,6 +36,7 @@ steps:
|
||||||
name: id_rsa # optional
|
name: id_rsa # optional
|
||||||
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
config: ${{ secrets.CONFIG }} # ssh_config; optional
|
config: ${{ secrets.CONFIG }} # ssh_config; optional
|
||||||
|
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)
|
||||||
- name: rsync over ssh
|
- name: rsync over ssh
|
||||||
run: rsync ./foo/ user@remote:bar/
|
run: rsync ./foo/ user@remote:bar/
|
||||||
```
|
```
|
||||||
|
@ -90,6 +89,14 @@ Check below:
|
||||||
* `Host key verification failed.`:
|
* `Host key verification failed.`:
|
||||||
* Set `known_hosts` parameter correctly (use `ssh-keyscan` command).
|
* Set `known_hosts` parameter correctly (use `ssh-keyscan` command).
|
||||||
|
|
||||||
|
### I want to replace/ignore key if exists.
|
||||||
|
|
||||||
|
Use `if_key_exists` parameter.
|
||||||
|
|
||||||
|
* `replace`: replaces key
|
||||||
|
* `ignore`: does nothing
|
||||||
|
* `fail`: fails (default)
|
||||||
|
|
||||||
### How do I use encrypted SSH key?
|
### How do I use encrypted SSH key?
|
||||||
|
|
||||||
This action doesn't support encrypted key directly.
|
This action doesn't support encrypted key directly.
|
||||||
|
@ -134,16 +141,12 @@ See [CHANGELOG.md](CHANGELOG.md).
|
||||||
|
|
||||||
[image-build]: https://github.com/shimataro/ssh-key-action/workflows/Build/badge.svg?event=push&branch=v2
|
[image-build]: https://github.com/shimataro/ssh-key-action/workflows/Build/badge.svg?event=push&branch=v2
|
||||||
[link-build]: https://github.com/shimataro/ssh-key-action/actions/workflows/build.yml
|
[link-build]: https://github.com/shimataro/ssh-key-action/actions/workflows/build.yml
|
||||||
[image-verify-windows-2019]: https://github.com/shimataro/ssh-key-action/workflows/Windows%20Server%202019/badge.svg?event=push&branch=v2
|
[image-verify-windows]: https://github.com/shimataro/ssh-key-action/workflows/Windows/badge.svg?event=push&branch=v2
|
||||||
[link-verify-windows-2019]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-windows-server-2019.yml
|
[link-verify-windows]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-windows.yml
|
||||||
[image-verify-macos-1015]: https://github.com/shimataro/ssh-key-action/workflows/macOS%20Catalina/badge.svg?event=push&branch=v2
|
[image-verify-macos]: https://github.com/shimataro/ssh-key-action/workflows/macOS/badge.svg?event=push&branch=v2
|
||||||
[link-verify-macos-1015]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-macos-1015.yml
|
[link-verify-macos]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-macos.yml
|
||||||
[image-verify-ubuntu-2004]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu%2020.04/badge.svg?event=push&branch=v2
|
[image-verify-ubuntu]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu/badge.svg?event=push&branch=v2
|
||||||
[link-verify-ubuntu-2004]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-ubuntu-2004.yml
|
[link-verify-ubuntu]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-ubuntu.yml
|
||||||
[image-verify-ubuntu-1804]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu%2018.04/badge.svg?event=push&branch=v2
|
|
||||||
[link-verify-ubuntu-1804]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-ubuntu-1804.yml
|
|
||||||
[image-verify-ubuntu-1604]: https://github.com/shimataro/ssh-key-action/workflows/Ubuntu%2016.04/badge.svg?event=push&branch=v2
|
|
||||||
[link-verify-ubuntu-1604]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-ubuntu-1604.yml
|
|
||||||
[image-verify-docker-container-ubuntu]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-ubuntu.yml/badge.svg?event=push&branch=v2
|
[image-verify-docker-container-ubuntu]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-ubuntu.yml/badge.svg?event=push&branch=v2
|
||||||
[link-verify-docker-container-ubuntu]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-ubuntu.yml
|
[link-verify-docker-container-ubuntu]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-ubuntu.yml
|
||||||
[image-verify-docker-container-centos]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-centos.yml/badge.svg?event=push&branch=v2
|
[image-verify-docker-container-centos]: https://github.com/shimataro/ssh-key-action/actions/workflows/verify-on-container-centos.yml/badge.svg?event=push&branch=v2
|
||||||
|
|
|
@ -21,6 +21,10 @@ inputs:
|
||||||
description: "SSH config"
|
description: "SSH config"
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
if_key_exists:
|
||||||
|
description: "replace / ignore / fail"
|
||||||
|
required: false
|
||||||
|
default: "fail"
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node12"
|
||||||
main: "lib/index.js"
|
main: "lib/index.js"
|
||||||
|
|
93
lib/index.js
93
lib/index.js
|
@ -427,36 +427,16 @@ const core = __importStar(__nccwpck_require__(186));
|
||||||
*/
|
*/
|
||||||
function main() {
|
function main() {
|
||||||
try {
|
try {
|
||||||
const files = [
|
// parameters
|
||||||
{
|
const key = core.getInput("key", {
|
||||||
name: core.getInput("name"),
|
required: true,
|
||||||
contents: insertLf(core.getInput("key", {
|
});
|
||||||
required: true,
|
const name = core.getInput("name");
|
||||||
}), false, true),
|
const knownHosts = core.getInput("known_hosts", {
|
||||||
options: {
|
required: true,
|
||||||
mode: 0o400,
|
});
|
||||||
flag: "ax",
|
const config = core.getInput("config");
|
||||||
},
|
const ifKeyExists = core.getInput("if_key_exists");
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "known_hosts",
|
|
||||||
contents: insertLf(core.getInput("known_hosts", {
|
|
||||||
required: true,
|
|
||||||
}), true, true),
|
|
||||||
options: {
|
|
||||||
mode: 0o644,
|
|
||||||
flag: "a",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "config",
|
|
||||||
contents: insertLf(core.getInput("config"), true, true),
|
|
||||||
options: {
|
|
||||||
mode: 0o644,
|
|
||||||
flag: "a",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
// create ".ssh" directory
|
// create ".ssh" directory
|
||||||
const home = getHomeDirectory();
|
const home = getHomeDirectory();
|
||||||
const dirName = path_1.default.resolve(home, ".ssh");
|
const dirName = path_1.default.resolve(home, ".ssh");
|
||||||
|
@ -464,6 +444,35 @@ function main() {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
mode: 0o700,
|
mode: 0o700,
|
||||||
});
|
});
|
||||||
|
// files to be created
|
||||||
|
const files = [
|
||||||
|
{
|
||||||
|
name: "known_hosts",
|
||||||
|
contents: insertLf(knownHosts, true, true),
|
||||||
|
options: {
|
||||||
|
mode: 0o644,
|
||||||
|
flag: "a",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "config",
|
||||||
|
contents: insertLf(config, true, true),
|
||||||
|
options: {
|
||||||
|
mode: 0o644,
|
||||||
|
flag: "a",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if (shouldCreateKeyFile(path_1.default.join(dirName, name), ifKeyExists)) {
|
||||||
|
files.push({
|
||||||
|
name: name,
|
||||||
|
contents: insertLf(key, false, true),
|
||||||
|
options: {
|
||||||
|
mode: 0o400,
|
||||||
|
flag: "wx",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
// create files
|
// create files
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const fileName = path_1.default.join(dirName, file.name);
|
const fileName = path_1.default.join(dirName, file.name);
|
||||||
|
@ -524,6 +533,30 @@ function insertLf(value, prepend, append) {
|
||||||
}
|
}
|
||||||
return affectedValue;
|
return affectedValue;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* should create SSH key file?
|
||||||
|
* @param keyFilePath path of key file
|
||||||
|
* @param ifKeyExists action if SSH key exists
|
||||||
|
* @returns Yes/No
|
||||||
|
*/
|
||||||
|
function shouldCreateKeyFile(keyFilePath, ifKeyExists) {
|
||||||
|
if (!fs_1.default.existsSync(keyFilePath)) {
|
||||||
|
// should create if file does not exist
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
switch (ifKeyExists) {
|
||||||
|
case "replace":
|
||||||
|
// remove file and should create if replace
|
||||||
|
fs_1.default.unlinkSync(keyFilePath);
|
||||||
|
return true;
|
||||||
|
case "ignore":
|
||||||
|
// should NOT create if ignore
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
// error otherwise
|
||||||
|
throw new Error(`SSH key is already installed. Set "if_key_exists" to "replace" or "ignore" in order to avoid this error.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
main();
|
main();
|
||||||
|
|
||||||
|
|
||||||
|
|
102
src/main.ts
102
src/main.ts
|
@ -17,36 +17,16 @@ function main(): void
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const files: FileInfo[] = [
|
// parameters
|
||||||
{
|
const key = core.getInput("key", {
|
||||||
name: core.getInput("name"),
|
required: true,
|
||||||
contents: insertLf(core.getInput("key", {
|
});
|
||||||
required: true,
|
const name = core.getInput("name");
|
||||||
}), false, true),
|
const knownHosts = core.getInput("known_hosts", {
|
||||||
options: {
|
required: true,
|
||||||
mode: 0o400,
|
});
|
||||||
flag: "ax",
|
const config = core.getInput("config");
|
||||||
},
|
const ifKeyExists = core.getInput("if_key_exists");
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "known_hosts",
|
|
||||||
contents: insertLf(core.getInput("known_hosts", {
|
|
||||||
required: true,
|
|
||||||
}), true, true),
|
|
||||||
options: {
|
|
||||||
mode: 0o644,
|
|
||||||
flag: "a",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "config",
|
|
||||||
contents: insertLf(core.getInput("config"), true, true),
|
|
||||||
options: {
|
|
||||||
mode: 0o644,
|
|
||||||
flag: "a",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// create ".ssh" directory
|
// create ".ssh" directory
|
||||||
const home = getHomeDirectory();
|
const home = getHomeDirectory();
|
||||||
|
@ -56,6 +36,37 @@ function main(): void
|
||||||
mode: 0o700,
|
mode: 0o700,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// files to be created
|
||||||
|
const files: FileInfo[] = [
|
||||||
|
{
|
||||||
|
name: "known_hosts",
|
||||||
|
contents: insertLf(knownHosts, true, true),
|
||||||
|
options: {
|
||||||
|
mode: 0o644,
|
||||||
|
flag: "a",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "config",
|
||||||
|
contents: insertLf(config, true, true),
|
||||||
|
options: {
|
||||||
|
mode: 0o644,
|
||||||
|
flag: "a",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if(shouldCreateKeyFile(path.join(dirName, name), ifKeyExists))
|
||||||
|
{
|
||||||
|
files.push({
|
||||||
|
name: name,
|
||||||
|
contents: insertLf(key, false, true),
|
||||||
|
options: {
|
||||||
|
mode: 0o400,
|
||||||
|
flag: "wx",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// create files
|
// create files
|
||||||
for(const file of files)
|
for(const file of files)
|
||||||
{
|
{
|
||||||
|
@ -137,4 +148,35 @@ function insertLf(value: string, prepend: boolean, append: boolean): string
|
||||||
return affectedValue;
|
return affectedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* should create SSH key file?
|
||||||
|
* @param keyFilePath path of key file
|
||||||
|
* @param ifKeyExists action if SSH key exists
|
||||||
|
* @returns Yes/No
|
||||||
|
*/
|
||||||
|
function shouldCreateKeyFile(keyFilePath: string, ifKeyExists: string): boolean
|
||||||
|
{
|
||||||
|
if(!fs.existsSync(keyFilePath))
|
||||||
|
{
|
||||||
|
// should create if file does not exist
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(ifKeyExists)
|
||||||
|
{
|
||||||
|
case "replace":
|
||||||
|
// remove file and should create if replace
|
||||||
|
fs.unlinkSync(keyFilePath);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case "ignore":
|
||||||
|
// should NOT create if ignore
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// error otherwise
|
||||||
|
throw new Error(`SSH key is already installed. Set "if_key_exists" to "replace" or "ignore" in order to avoid this error.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue