Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/acceptance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
acceptance-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
auth: [connect, service-account]
exclude:
- os: macos-latest
Expand Down Expand Up @@ -60,11 +60,13 @@ jobs:
if: ${{ matrix.auth == 'service-account' }}
uses: ./configure
with:
runner: ${{ runner.os }}
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
- name: Configure 1Password Connect
if: ${{ matrix.auth == 'connect' }}
uses: ./configure # 1password/load-secrets-action/configure@<version>
with:
runner: ${{ runner.os }}
connect-host: http://localhost:8080
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
- name: Load secrets
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
github.event.client_payload.pull_request.head.sha,
github.event.client_payload.slash_command.args.named.sha
)
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@main
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@vzt/windows-support
secrets: inherit
with:
secret: op://acceptance-tests/test-secret/password
Expand All @@ -27,7 +27,7 @@ jobs:
github.event.client_payload.pull_request.head.sha,
github.event.client_payload.slash_command.args.named.sha
)
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@main
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@vzt/windows-support
secrets: inherit
with:
secret: op://acceptance-tests/test-secret/password
Expand All @@ -42,7 +42,7 @@ jobs:
github.event.client_payload.pull_request.head.sha,
github.event.client_payload.slash_command.args.named.sha
)
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@main
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@vzt/windows-support
secrets: inherit
with:
secret: op://v5pz6venw4roosmkzdq2nhpv6u/hrgkzhrlvscomepxlgafb2m3ca/password
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
)
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@main
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@vzt/windows-support
secrets: inherit
with:
secret: op://acceptance-tests/test-secret/password
Expand All @@ -35,7 +35,7 @@ jobs:
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
)
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@main
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@vzt/windows-support
secrets: inherit
with:
secret: op://acceptance-tests/test-secret/password
Expand All @@ -49,7 +49,7 @@ jobs:
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
)
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@main
uses: 1password/load-secrets-action/.github/workflows/acceptance-test.yml@vzt/windows-support
secrets: inherit
with:
secret: op://v5pz6venw4roosmkzdq2nhpv6u/hrgkzhrlvscomepxlgafb2m3ca/password
Expand Down
17 changes: 16 additions & 1 deletion configure/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ inputs:
description: Token to authenticate to your 1Password Connect instance
service-account-token:
description: Your 1Password service account token
runner:
description: The runner to use for this action. Valid values are `Linux`, `Windows`, and `macOS`.
default: ubuntu
required: false
type: string
runs:
using: composite
steps:
- shell: bash
- if: ${{ inputs.runner == 'Windows' }}
shell: pwsh
env:
INPUT_CONNECT_HOST: ${{ inputs.connect-host }}
INPUT_CONNECT_TOKEN: ${{ inputs.connect-token }}
INPUT_SERVICE_ACCOUNT_TOKEN: ${{ inputs.service-account-token }}
run: |
${{ github.action_path }}/entrypoint.ps1

- if: ${{ inputs.runner != 'Windows' }}
shell: bash
env:
INPUT_CONNECT_HOST: ${{ inputs.connect-host }}
INPUT_CONNECT_TOKEN: ${{ inputs.connect-token }}
Expand Down
17 changes: 17 additions & 0 deletions configure/entrypoint.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if ($env:INPUT_CONNECT_HOST) {
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_HOST=$($env:INPUT_CONNECT_HOST)" -Encoding utf8
} elseif ($env:OP_CONNECT_HOST) {
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_HOST=$($env:OP_CONNECT_HOST)" -Encoding utf8
}

if ($env:INPUT_CONNECT_TOKEN) {
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_TOKEN=$($env:INPUT_CONNECT_TOKEN)" -Encoding utf8
} elseif ($env:OP_CONNECT_TOKEN) {
Add-Content -Path $env:GITHUB_ENV -Value "OP_CONNECT_TOKEN=$($env:OP_CONNECT_TOKEN)" -Encoding utf8
}

if ($env:INPUT_SERVICE_ACCOUNT_TOKEN) {
Add-Content -Path $env:GITHUB_ENV -Value "OP_SERVICE_ACCOUNT_TOKEN=$($env:INPUT_SERVICE_ACCOUNT_TOKEN)" -Encoding utf8
} elseif ($env:OP_SERVICE_ACCOUNT_TOKEN) {
Add-Content -Path $env:GITHUB_ENV -Value "OP_SERVICE_ACCOUNT_TOKEN=$($env:OP_SERVICE_ACCOUNT_TOKEN)" -Encoding utf8
}
9 changes: 6 additions & 3 deletions install_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ install_op_cli() {
# Get the latest stable version of the CLI
CLI_VERSION="v$(curl https://app-updates.agilebits.com/check/1/0/CLI2/en/2.0.0/N -s | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ "$RUNNER_OS" == "Linux" ]]; then
# Get runner's architecture
ARCH=$(uname -m)
if [[ "$(getconf LONG_BIT)" = 32 ]]; then
Expand All @@ -32,13 +32,16 @@ install_op_cli() {

curl -sSfLo op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/${CLI_VERSION}/op_linux_${ARCH}_${CLI_VERSION}.zip"
unzip -od "$OP_INSTALL_DIR" op.zip && rm op.zip
elif [[ "$OSTYPE" == "darwin"* ]]; then
elif [[ "$RUNNER_OS" == "macOS" ]]; then
curl -sSfLo op.pkg "https://cache.agilebits.com/dist/1P/op2/pkg/${CLI_VERSION}/op_apple_universal_${CLI_VERSION}.pkg"
pkgutil --expand op.pkg temp-pkg
tar -xvf temp-pkg/op.pkg/Payload -C "$OP_INSTALL_DIR"
rm -rf temp-pkg && rm op.pkg
elif [ "$RUNNER_OS" = "Windows" ]; then
pwsh -Command "Invoke-WebRequest -Uri https://cache.agilebits.com/dist/1P/op2/pkg/${CLI_VERSION}/op_windows_amd64_${CLI_VERSION}.zip -OutFile op.zip"
pwsh -Command "Expand-Archive -Path op.zip -DestinationPath '${OP_INSTALL_DIR}'; Remove-Item op.zip"
else
echo "Operating system not supported yet for this GitHub Action: $OSTYPE."
echo "Operating system not supported yet for this GitHub Action: $RUNNER_OS."
exit 1
fi
}
Expand Down
Loading