|
| 1 | +# https://docs.github.com/en/actions/using-workflows/reusing-workflows |
| 2 | +name: Reusable workflow (verify) |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + os: |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + description: host OS that CI 'runs-on' |
| 11 | + docker_image: |
| 12 | + required: false |
| 13 | + type: string |
| 14 | + default: "" |
| 15 | + description: Docker image name |
| 16 | + package_installation_command: |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + default: "" |
| 20 | + description: package installation command |
| 21 | + secrets: |
| 22 | + SSH_KEY_PEM: |
| 23 | + required: true |
| 24 | + description: SSH private key (PEM format) |
| 25 | + SSH_KEY_PKCS8: |
| 26 | + required: true |
| 27 | + description: SSH private key (PKCS8 format) |
| 28 | + SSH_KEY_RFC4716: |
| 29 | + required: true |
| 30 | + description: SSH private key (RFC4716 format) |
| 31 | + |
| 32 | +jobs: |
| 33 | + ssh-pem: |
| 34 | + name: Connect to github.com (PEM format) |
| 35 | + runs-on: ${{ inputs.os }} |
| 36 | + container: ${{ inputs.docker_image }} |
| 37 | + steps: |
| 38 | + - name: Install packages |
| 39 | + run: ${{ inputs.package_installation_command }} |
| 40 | + if: ${{ inputs.package_installation_command != '' }} |
| 41 | + - name: Checkout source codes |
| 42 | + uses: actions/checkout@v3 |
| 43 | + - name: Install SSH key |
| 44 | + uses: ./. |
| 45 | + with: |
| 46 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 47 | + known_hosts: unnecessary |
| 48 | + - name: git clone through SSH |
| 49 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 50 | + |
| 51 | + ssh-pem-bitbucket: |
| 52 | + name: Connect to bitbucket.org (PEM format) |
| 53 | + runs-on: ${{ inputs.os }} |
| 54 | + container: ${{ inputs.docker_image }} |
| 55 | + steps: |
| 56 | + - name: Install packages |
| 57 | + run: ${{ inputs.package_installation_command }} |
| 58 | + if: ${{ inputs.package_installation_command != '' }} |
| 59 | + - name: Checkout source codes |
| 60 | + uses: actions/checkout@v3 |
| 61 | + - name: Install SSH key |
| 62 | + uses: ./. |
| 63 | + with: |
| 64 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 65 | + known_hosts: | |
| 66 | + bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== |
| 67 | + - name: git clone through SSH |
| 68 | + run: git clone git@bitbucket.org:shimataro999/ssh-test.git tmp |
| 69 | + |
| 70 | + ssh-pkcs8: |
| 71 | + name: Connect to github.com (PKCS8 format) |
| 72 | + runs-on: ${{ inputs.os }} |
| 73 | + container: ${{ inputs.docker_image }} |
| 74 | + steps: |
| 75 | + - name: Install packages |
| 76 | + run: ${{ inputs.package_installation_command }} |
| 77 | + if: ${{ inputs.package_installation_command != '' }} |
| 78 | + - name: Checkout source codes |
| 79 | + uses: actions/checkout@v3 |
| 80 | + - name: Install SSH key |
| 81 | + uses: ./. |
| 82 | + with: |
| 83 | + key: ${{ secrets.SSH_KEY_PKCS8 }} |
| 84 | + known_hosts: unnecessary |
| 85 | + - name: git clone through SSH |
| 86 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 87 | + |
| 88 | + ssh-pkcs8-bitbucket: |
| 89 | + name: Connect to bitbucket.org (PKCS8 format) |
| 90 | + runs-on: ${{ inputs.os }} |
| 91 | + container: ${{ inputs.docker_image }} |
| 92 | + steps: |
| 93 | + - name: Install packages |
| 94 | + run: ${{ inputs.package_installation_command }} |
| 95 | + if: ${{ inputs.package_installation_command != '' }} |
| 96 | + - name: Checkout source codes |
| 97 | + uses: actions/checkout@v3 |
| 98 | + - name: Install SSH key |
| 99 | + uses: ./. |
| 100 | + with: |
| 101 | + key: ${{ secrets.SSH_KEY_PKCS8 }} |
| 102 | + known_hosts: | |
| 103 | + bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== |
| 104 | + - name: git clone through SSH |
| 105 | + run: git clone git@bitbucket.org:shimataro999/ssh-test.git tmp |
| 106 | + |
| 107 | + ssh-rfc4716: |
| 108 | + name: Connect to github.com (RFC4716 format) |
| 109 | + runs-on: ${{ inputs.os }} |
| 110 | + container: ${{ inputs.docker_image }} |
| 111 | + steps: |
| 112 | + - name: Install packages |
| 113 | + run: ${{ inputs.package_installation_command }} |
| 114 | + if: ${{ inputs.package_installation_command != '' }} |
| 115 | + - name: Checkout source codes |
| 116 | + uses: actions/checkout@v3 |
| 117 | + - name: Install SSH key |
| 118 | + uses: ./. |
| 119 | + with: |
| 120 | + key: ${{ secrets.SSH_KEY_RFC4716 }} |
| 121 | + known_hosts: unnecessary |
| 122 | + - name: git clone through SSH |
| 123 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 124 | + |
| 125 | + ssh-rfc4716-bitbucket: |
| 126 | + name: Connect to bitbucket.org (RFC4716 format) |
| 127 | + runs-on: ${{ inputs.os }} |
| 128 | + container: ${{ inputs.docker_image }} |
| 129 | + steps: |
| 130 | + - name: Install packages |
| 131 | + run: ${{ inputs.package_installation_command }} |
| 132 | + if: ${{ inputs.package_installation_command != '' }} |
| 133 | + - name: Checkout source codes |
| 134 | + uses: actions/checkout@v3 |
| 135 | + - name: Install SSH key |
| 136 | + uses: ./. |
| 137 | + with: |
| 138 | + key: ${{ secrets.SSH_KEY_RFC4716 }} |
| 139 | + known_hosts: | |
| 140 | + bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== |
| 141 | + - name: git clone through SSH |
| 142 | + run: git clone git@bitbucket.org:shimataro999/ssh-test.git tmp |
| 143 | + |
| 144 | + key_if_exists_replace-key_exists: |
| 145 | + name: if_key_exists=replace / key exists |
| 146 | + runs-on: ${{ inputs.os }} |
| 147 | + container: ${{ inputs.docker_image }} |
| 148 | + steps: |
| 149 | + - name: Install packages |
| 150 | + run: ${{ inputs.package_installation_command }} |
| 151 | + if: ${{ inputs.package_installation_command != '' }} |
| 152 | + - name: Checkout source codes |
| 153 | + uses: actions/checkout@v3 |
| 154 | + - name: Install SSH key (dummy) |
| 155 | + uses: ./. |
| 156 | + with: |
| 157 | + key: "dummy" # replaced |
| 158 | + known_hosts: unnecessary |
| 159 | + - name: Install SSH key (replace) |
| 160 | + uses: ./. |
| 161 | + with: |
| 162 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 163 | + known_hosts: unnecessary |
| 164 | + if_key_exists: replace |
| 165 | + - name: git clone through SSH |
| 166 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 167 | + |
| 168 | + key_if_exists_replace-key_doesnt_exist: |
| 169 | + name: if_key_exists=replace / key doesn't exist |
| 170 | + runs-on: ${{ inputs.os }} |
| 171 | + container: ${{ inputs.docker_image }} |
| 172 | + steps: |
| 173 | + - name: Install packages |
| 174 | + run: ${{ inputs.package_installation_command }} |
| 175 | + if: ${{ inputs.package_installation_command != '' }} |
| 176 | + - name: Checkout source codes |
| 177 | + uses: actions/checkout@v3 |
| 178 | + - name: Install SSH key (replace) |
| 179 | + uses: ./. |
| 180 | + with: |
| 181 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 182 | + known_hosts: unnecessary |
| 183 | + if_key_exists: replace |
| 184 | + - name: git clone through SSH |
| 185 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 186 | + |
| 187 | + key_if_exists_ignore-key_exists: |
| 188 | + name: if_key_exists=ignore / key exists |
| 189 | + runs-on: ${{ inputs.os }} |
| 190 | + container: ${{ inputs.docker_image }} |
| 191 | + steps: |
| 192 | + - name: Install packages |
| 193 | + run: ${{ inputs.package_installation_command }} |
| 194 | + if: ${{ inputs.package_installation_command != '' }} |
| 195 | + - name: Checkout source codes |
| 196 | + uses: actions/checkout@v3 |
| 197 | + - name: Install SSH key (dummy) |
| 198 | + uses: ./. |
| 199 | + with: |
| 200 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 201 | + known_hosts: unnecessary |
| 202 | + - name: Install SSH key (replace) |
| 203 | + uses: ./. |
| 204 | + with: |
| 205 | + key: "dummy" # ignored |
| 206 | + known_hosts: unnecessary |
| 207 | + if_key_exists: ignore |
| 208 | + - name: git clone through SSH |
| 209 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 210 | + |
| 211 | + key_if_exists_ignore-key_doesnt_exist: |
| 212 | + name: if_key_exists=ignore / key doesn't exist |
| 213 | + runs-on: ${{ inputs.os }} |
| 214 | + container: ${{ inputs.docker_image }} |
| 215 | + steps: |
| 216 | + - name: Install packages |
| 217 | + run: ${{ inputs.package_installation_command }} |
| 218 | + if: ${{ inputs.package_installation_command != '' }} |
| 219 | + - name: Checkout source codes |
| 220 | + uses: actions/checkout@v3 |
| 221 | + - name: Install SSH key (replace) |
| 222 | + uses: ./. |
| 223 | + with: |
| 224 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 225 | + known_hosts: unnecessary |
| 226 | + if_key_exists: ignore |
| 227 | + - name: git clone through SSH |
| 228 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 229 | + |
| 230 | + key_if_exists_fail-key_exists: |
| 231 | + name: if_key_exists=fail / key exists |
| 232 | + runs-on: ${{ inputs.os }} |
| 233 | + container: ${{ inputs.docker_image }} |
| 234 | + steps: |
| 235 | + - name: Install packages |
| 236 | + run: ${{ inputs.package_installation_command }} |
| 237 | + if: ${{ inputs.package_installation_command != '' }} |
| 238 | + - name: Checkout source codes |
| 239 | + uses: actions/checkout@v3 |
| 240 | + - name: Install SSH key (dummy) |
| 241 | + uses: ./. |
| 242 | + with: |
| 243 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 244 | + known_hosts: unnecessary |
| 245 | + - name: Install SSH key (replace) |
| 246 | + uses: ./. |
| 247 | + with: |
| 248 | + key: "dummy" # ignored |
| 249 | + known_hosts: unnecessary |
| 250 | + if_key_exists: fail |
| 251 | + continue-on-error: true |
| 252 | + - name: git clone through SSH |
| 253 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
| 254 | + |
| 255 | + key_if_exists_fail-key_doesnt_exist: |
| 256 | + name: if_key_exists=fail / key doesn't exist |
| 257 | + runs-on: ${{ inputs.os }} |
| 258 | + container: ${{ inputs.docker_image }} |
| 259 | + steps: |
| 260 | + - name: Install packages |
| 261 | + run: ${{ inputs.package_installation_command }} |
| 262 | + if: ${{ inputs.package_installation_command != '' }} |
| 263 | + - name: Checkout source codes |
| 264 | + uses: actions/checkout@v3 |
| 265 | + - name: Install SSH key (replace) |
| 266 | + uses: ./. |
| 267 | + with: |
| 268 | + key: ${{ secrets.SSH_KEY_PEM }} |
| 269 | + known_hosts: unnecessary |
| 270 | + if_key_exists: fail |
| 271 | + - name: git clone through SSH |
| 272 | + run: git clone git@github.com:shimataro/ssh-key-action.git tmp |
0 commit comments