From 196c26b25e2cedef95b65d7b07d268c0de294a35 Mon Sep 17 00:00:00 2001 From: meanmail Date: Thu, 19 Oct 2023 12:28:58 +0400 Subject: [PATCH] Add action --- .idea/.gitignore | 8 ++++++++ README.md | 9 +++++++++ action.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 action.yml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/README.md b/README.md index c904aa8..bd95191 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ # hyperskill-azure-login Hyperskill GitHub Action | Azure Install and login + +```yaml +- uses: actions/hyperskill-azure-login@v1 + with: + client_id: ${{ secrets.CLIENT_ID }} + client_secret: ${{ secrets.CLIENT_SECRET }} + subscription_id: ${{ secrets.SUBSCRIPTION_ID }} + tenant_id: ${{ secrets.TENANT_ID }} +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..0755264 --- /dev/null +++ b/action.yml @@ -0,0 +1,41 @@ +name: 'Login to Azure' +description: 'Install azure cli and login to Azure' + +inputs: + client_id: + required: true + description: Azure client id + client_secret: + required: true + description: Azure client secret + subscription_id: + required: true + description: Azure subscription id + tenant_id: + required: true + description: Azure tenant id + +runs: + using: "composite" + steps: + - name: Install Azure cli + run: | + sudo apt-get install -y \ + ca-certificates \ + curl \ + apt-transport-https \ + lsb-release \ + gnupg \ + software-properties-common + curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null + AZ_REPO=$(lsb_release -cs) + echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list + sudo apt-get update + sudo apt-get install -y \ + azure-cli + shell: bash + + - name: Azure Login + uses: azure/login@v1 + with: + creds: '{"clientId":"${{ inputs.client_id }}","clientSecret":"${{ inputs.client_secret }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ inputs.tenant_id }}"}'