1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00
ssh-key-action/.github/workflows/verify-on-macos.yml
shimataro 954c620b17
Feature/no known hosts (#181)
* 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

* test no_known_hosts parameter

* implement

* ignore known_hosts if no_known_hosts is true

* refactor

* no_known_hosts is false

* Revert "no_known_hosts is false"

This reverts commit 206d310c5c.

* test on Windows / macOS

* test on Docker containers

* add tests for Docker containers

* test no_known_hosts parameter

* implement

* ignore known_hosts if no_known_hosts is true

* refactor

* no_known_hosts is false

* Revert "no_known_hosts is false"

This reverts commit 206d310c5c.

* test on Windows / macOS

* test on Docker containers

* use `known_hosts: no` instead of `no_known_hosts: true`

* update README

* update README

* "known_hosts: no" -> "known_hosts: unnecessary"

* update README

* update README

* update CHANGELOG
2021-03-21 15:43:28 +09:00

260 lines
7 KiB
YAML

# 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
known_hosts-unnecessary:
name: without known_hosts file
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: unnecessary
- name: print created files
run: ls -l ~/.ssh