1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00

Feature/container (#170)

* support Docker container

* move .ssh to /root

* remove print step

* change home directory for Docker container

* print HOME

* print home

* print home

* update dist file

* update dirname

* update CHANGELOG

* add badge
This commit is contained in:
shimataro 2021-02-08 23:31:19 +09:00 committed by GitHub
parent 0b924ac88f
commit 026e5f82bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,28 @@
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: Docker container on Ubuntu 20.04
on:
- push
jobs:
ssh:
name: Connect to github.com
runs-on: ubuntu-20.04
container: 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
uses: ./.
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- 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

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
* Support Docker container (thanks [@kujaomega](https://github.com/kujaomega))
### Changed
* Bundle dependencies (thanks [@tats-u](https://github.com/tats-u))

View file

@ -6,6 +6,7 @@
[![Ubuntu 20.04][image-verify-ubuntu-2004]][link-verify-ubuntu-2004]
[![Ubuntu 18.04][image-verify-ubuntu-1804]][link-verify-ubuntu-1804]
[![Ubuntu 16.04][image-verify-ubuntu-1604]][link-verify-ubuntu-1604]
[![Docker container][image-verify-docker-container]][link-verify-docker-container]
[![Release][image-release]][link-release]
[![License][image-license]][link-license]
[![Stars][image-stars]][link-stars]
@ -144,6 +145,8 @@ See [CHANGELOG.md](CHANGELOG.md).
[link-verify-ubuntu-1804]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3A%22Ubuntu+18.04%22
[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?query=workflow%3A%22Ubuntu+16.04%22
[image-verify-docker-container]: https://github.com/shimataro/ssh-key-action/workflows/Docker%20container%20on%20Ubuntu%2020.04/badge.svg?event=push&branch=v2
[link-verify-docker-container]: https://github.com/shimataro/ssh-key-action/actions?query=workflow%3A%22Docker+container+on+Ubuntu+20.04%22
[image-release]: https://img.shields.io/github/release/shimataro/ssh-key-action.svg
[link-release]: https://github.com/shimataro/ssh-key-action/releases
[image-license]: https://img.shields.io/github/license/shimataro/ssh-key-action.svg

View file

@ -485,6 +485,10 @@ function getHomeDirectory() {
if (home === undefined) {
throw Error(`${homeEnv} is not defined`);
}
if (home === "/github/home") {
// Docker container
return "/root";
}
return home;
}
/**

View file

@ -84,6 +84,12 @@ function getHomeDirectory(): string
throw Error(`${homeEnv} is not defined`);
}
if(home === "/github/home")
{
// Docker container
return "/root";
}
return home;
}