Skip to content

Commit 8c4f3f2

Browse files
Add Windows support to acceptance tests and configure action
1 parent 6c05816 commit 8c4f3f2

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

.github/workflows/acceptance-test.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,30 @@ jobs:
5656
run: |
5757
echo "$OP_CONNECT_CREDENTIALS" > 1password-credentials.json
5858
docker compose -f tests/fixtures/docker-compose.yml up -d && sleep 10
59-
- name: Configure Service account
59+
- name: Configure Service account for Linux or MacOS runner
6060
if: ${{ matrix.auth == 'service-account' }}
6161
uses: ./configure
6262
with:
6363
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
64-
- name: Configure 1Password Connect
64+
- name: Configure 1Password Connect for Linux or MacOS runner
6565
if: ${{ matrix.auth == 'connect' }}
6666
uses: ./configure # 1password/load-secrets-action/configure@<version>
6767
with:
6868
connect-host: http://localhost:8080
6969
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
70+
- name: Configure Service account for Windows runner
71+
if: ${{ matrix.auth == 'service-account' }}
72+
uses: ./configure
73+
with:
74+
runner: 'windows'
75+
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
76+
- name: Configure 1Password Connect for Windows runner
77+
if: ${{ matrix.auth == 'connect' }}
78+
uses: ./configure # 1password/load-secrets-action/configure@<version>
79+
with:
80+
runner: 'windows'
81+
connect-host: http://localhost:8080
82+
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
7083
- name: Load secrets
7184
id: load_secrets
7285
uses: ./ # 1password/load-secrets-action@<version>

configure/action.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,26 @@ inputs:
88
description: Token to authenticate to your 1Password Connect instance
99
service-account-token:
1010
description: Your 1Password service account token
11+
runner:
12+
description: The runner to use for this action. Valid values are `ubuntu`, `windows`, and `macos`.
13+
default: ubuntu
14+
required: false
15+
type: string
1116
runs:
1217
using: composite
1318
steps:
14-
- shell: bash
19+
- if: ${{ inputs.runner == 'windows' }}
20+
shell: pwsh
1521
env:
1622
INPUT_CONNECT_HOST: ${{ inputs.connect-host }}
1723
INPUT_CONNECT_TOKEN: ${{ inputs.connect-token }}
1824
INPUT_SERVICE_ACCOUNT_TOKEN: ${{ inputs.service-account-token }}
19-
run: |
20-
${{ github.action_path }}/entrypoint.sh
25+
run: ./entrypoint.ps1
26+
27+
- if: ${{ inputs.runner != 'windows' }}
28+
shell: bash
29+
env:
30+
INPUT_CONNECT_HOST: ${{ inputs.connect-host }}
31+
INPUT_CONNECT_TOKEN: ${{ inputs.connect-token }}
32+
INPUT_SERVICE_ACCOUNT_TOKEN: ${{ inputs.service-account-token }}
33+
run: ./entrypoint.sh

configure/entrypoint.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if ($env:INPUT_CONNECT_HOST) {
2+
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_HOST=$($env:INPUT_CONNECT_HOST)" -Encoding utf8
3+
} elseif ($env:OP_CONNECT_HOST) {
4+
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_HOST=$($env:OP_CONNECT_HOST)" -Encoding utf8
5+
}
6+
7+
if ($env:INPUT_CONNECT_TOKEN) {
8+
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_TOKEN=$($env:INPUT_CONNECT_TOKEN)" -Encoding utf8
9+
} elseif ($env:OP_CONNECT_TOKEN) {
10+
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_TOKEN=$($env:OP_CONNECT_TOKEN)" -Encoding utf8
11+
}
12+
13+
if ($env:INPUT_SERVICE_ACCOUNT_TOKEN) {
14+
Add-Content -Path $env:GITHUB_ENV -Value "OP_SERVICE_ACCOUNT_TOKEN=$($env:INPUT_SERVICE_ACCOUNT_TOKEN)" -Encoding utf8
15+
} elseif ($env:OP_SERVICE_ACCOUNT_TOKEN) {
16+
Add-Content -Path $env:GITHUB_ENV -Value "OP_SERVICE_ACCOUNT_TOKEN=$($env:OP_SERVICE_ACCOUNT_TOKEN)" -Encoding utf8
17+
}

0 commit comments

Comments
 (0)