Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v2' into sync-upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
jwj019 committed Jun 12, 2024
2 parents 27f96d6 + d4fffb5 commit f4d9ff5
Show file tree
Hide file tree
Showing 21 changed files with 4,317 additions and 5,835 deletions.
25 changes: 25 additions & 0 deletions .github/actions/cache-npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: Cache NPM
description: Composite action (cache NPM)

runs:
using: composite
steps:
# https://github.com/actions/cache/blob/master/examples.md#node---npm
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
- name: Get NPM cache directory
run: echo "NPM_CACHE_DIRECTORY=$(npm config get cache)" >> ${{ github.env }} # use "github.env" instead of "github.output"; if use "github.output", "Warning: Input required and not supplied: path" is displayed on post-process
shell: pwsh # use PowerShell; Bash doesn't work on Windows because the value of "github.env" is like "D:\a\_temp\_runner_file_commands\set_env_XXX".

- name: Get Node.js version
run: echo "NODEJS_VERSION=$(node -v)" >> ${{ github.env }}
shell: pwsh

- name: Cache NPM modules
uses: actions/cache@v3
with:
path: ${{ env.NPM_CACHE_DIRECTORY }}
key: npm-${{ runner.os }}-${{ runner.arch }}-${{ env.NODEJS_VERSION }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-${{ runner.os }}-${{ runner.arch }}-${{ env.NODEJS_VERSION }}-
npm-${{ runner.os }}-${{ runner.arch }}
24 changes: 13 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,31 @@ jobs:
strategy:
matrix:
os:
- Windows-2019
- Windows-2022
- macOS-10.15
- macOS-11
- macOS-12
- Ubuntu-18.04
- Ubuntu-20.04
- Ubuntu-22.04
- windows-2019
- windows-2022
- macos-11
- macos-12
- ubuntu-20.04
- ubuntu-22.04
nodejs:
- 16
- 20
fail-fast: false
steps:
- name: Turn off auto-crlf
run: git config --global core.autocrlf false
- name: Checkout source codes
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodejs }}
- name: Cache NPM
uses: ./.github/actions/cache-npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Exit if differ (forgot to commit dist dir?)
run: git diff --exit-code --quiet
- name: Verify
run: npm run verify
36 changes: 18 additions & 18 deletions .github/workflows/reusable-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

ssh-pkcs8:
name: Connect to github.com (PKCS8 format)
Expand All @@ -64,7 +64,7 @@ jobs:
key: ${{ secrets.SSH_KEY_PKCS8 }}
known_hosts: unnecessary
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

ssh-rfc4716:
name: Connect to github.com (RFC4716 format)
Expand All @@ -82,7 +82,7 @@ jobs:
key: ${{ secrets.SSH_KEY_RFC4716 }}
known_hosts: unnecessary
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

key_if_exists_replace-key_exists:
name: if_key_exists=replace / key exists
Expand All @@ -99,14 +99,14 @@ jobs:
with:
key: "dummy" # replaced
known_hosts: unnecessary
- name: Install SSH key (replace)
- name: Install SSH key (replaces existing key)
uses: ./.
with:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
if_key_exists: replace
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

key_if_exists_replace-key_doesnt_exist:
name: if_key_exists=replace / key doesn't exist
Expand All @@ -118,14 +118,14 @@ jobs:
if: ${{ inputs.package_installation_command != '' }}
- name: Checkout source codes
uses: actions/checkout@v3
- name: Install SSH key (replace)
- name: Install SSH key
uses: ./.
with:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
if_key_exists: replace
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

key_if_exists_ignore-key_exists:
name: if_key_exists=ignore / key exists
Expand All @@ -137,19 +137,19 @@ jobs:
if: ${{ inputs.package_installation_command != '' }}
- name: Checkout source codes
uses: actions/checkout@v3
- name: Install SSH key (dummy)
- name: Install SSH key
uses: ./.
with:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
- name: Install SSH key (replace)
- name: Install SSH key (does nothing)
uses: ./.
with:
key: "dummy" # ignored
known_hosts: unnecessary
if_key_exists: ignore
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

key_if_exists_ignore-key_doesnt_exist:
name: if_key_exists=ignore / key doesn't exist
Expand All @@ -161,14 +161,14 @@ jobs:
if: ${{ inputs.package_installation_command != '' }}
- name: Checkout source codes
uses: actions/checkout@v3
- name: Install SSH key (replace)
- name: Install SSH key
uses: ./.
with:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
if_key_exists: ignore
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

key_if_exists_fail-key_exists:
name: if_key_exists=fail / key exists
Expand All @@ -180,20 +180,20 @@ jobs:
if: ${{ inputs.package_installation_command != '' }}
- name: Checkout source codes
uses: actions/checkout@v3
- name: Install SSH key (dummy)
- name: Install SSH key
uses: ./.
with:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
- name: Install SSH key (replace)
- name: Install SSH key (fails)
uses: ./.
with:
key: "dummy" # ignored
key: "dummy" # fails
known_hosts: unnecessary
if_key_exists: fail
continue-on-error: true
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp

key_if_exists_fail-key_doesnt_exist:
name: if_key_exists=fail / key doesn't exist
Expand All @@ -205,11 +205,11 @@ jobs:
if: ${{ inputs.package_installation_command != '' }}
- name: Checkout source codes
uses: actions/checkout@v3
- name: Install SSH key (replace)
- name: Install SSH key
uses: ./.
with:
key: ${{ secrets.SSH_KEY_PEM }}
known_hosts: unnecessary
if_key_exists: fail
- name: git clone through SSH
run: git clone git@github.com:niaid/ssh-key-action.git tmp
run: git clone git@github.com:niaid/monarch-actions-key-writer.git tmp
1 change: 0 additions & 1 deletion .github/workflows/verify-on-container-centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
- ubuntu-20.04
- ubuntu-22.04
docker_image:
- quay.io/centos/centos:centos7
- quay.io/centos/centos:stream8
uses: "./.github/workflows/reusable-verify.yml"
with:
Expand Down
28 changes: 23 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.7.0] - 2024-02-11

### Others

* Update to Node.js v20 (thanks [@princemaple](https://github.com/princemaple))
* drop old containers; Ubuntu 16.04, and CentOS 7

## [2.6.1] - 2023-10-13

### Fixed

* JSON parse error on exit, if `if_key_exists`=`fail` and key exists

## [2.6.0] - 2023-10-11

### Others

* back up and restore files when exist (thanks [@bambeusz](https://github.com/bambeusz))
* remove `macos-10.15` and `ubuntu-18.04` virtual environment

## [2.5.1] - 2023-03-25

Expand Down Expand Up @@ -37,10 +56,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* drop `ubuntu-16.04`, and `CentOS 8 (Docker container)`
* [update Node.js version to 16](https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/) (thanks [@duddu](https://github.com/duddu))

## [2.3.1] - 2022-03-04

Created fork niaid/monarch-actions-key-writer

## [2.3.1] - 2021-08-01

### Security
Expand Down Expand Up @@ -191,7 +206,10 @@ Created fork niaid/monarch-actions-key-writer

* First release.

[Unreleased]: https://github.com/shimataro/ssh-key-action/compare/v2.5.1...HEAD
[Unreleased]: https://github.com/shimataro/ssh-key-action/compare/v2.7.0...HEAD
[2.7.0]: https://github.com/shimataro/ssh-key-action/compare/v2.6.1...v2.7.0
[2.6.1]: https://github.com/shimataro/ssh-key-action/compare/v2.6.0...v2.6.1
[2.6.0]: https://github.com/shimataro/ssh-key-action/compare/v2.5.1...v2.6.0
[2.5.1]: https://github.com/shimataro/ssh-key-action/compare/v2.5.0...v2.5.1
[2.5.0]: https://github.com/shimataro/ssh-key-action/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/shimataro/ssh-key-action/compare/v2.3.1...v2.4.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Useful for SCP, SFTP, and `rsync` over SSH in deployment script.

tested on:

* [all available virtual machines](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources) (Windows Server 2022/2019, macOS Monterey/Big Sur/Catalina, and Ubuntu 22.04/20.04/18.04)
* [all available virtual machines](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources) (Windows Server 2022/2019, macOS Monterey/Big Sur, and Ubuntu 22.04/20.04)
* [Docker container (Ubuntu)](https://hub.docker.com/_/ubuntu) / requires `openssh-client` package; `apt install -y openssh-client`
* [Docker container (CentOS)](https://quay.io/repository/centos/centos) / requires `openssh-clients` package; `yum install -y openssh-clients`
* [Docker container (Alpine Linux)](https://hub.docker.com/_/alpine) / requires `openssh-client` package; `apk add openssh-client`
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ inputs:
required: false
default: "fail"
runs:
using: "node16"
main: "lib/index.js"
post: "lib/index.js"
using: "node20"
main: "./dist/main.js"
post: "./dist/post.js"
Loading

0 comments on commit f4d9ff5

Please sign in to comment.