# Integrating GitHub Actions

Source: https://www.jawsdeploy.net/guides/integrating-github-actions

Add one step at the end of your workflow that creates a Jaws Deploy release tied to the commit you just built.

Jaws Deploy works with GitHub Actions through the REST API or the PowerShell SDK. The shape is the same as any CI integration: build and test in GitHub Actions, then call out at the end of the workflow to create a release.

## Add at the end of an existing workflow

Store the service account ID and API key in GitHub Actions secrets (`Settings -> Secrets and variables -> Actions`).

```
- name: Create Jaws Deploy release
  shell: pwsh
  env:
    JAWS_API_LOGIN: ${{ secrets.JAWS_SERVICE_ACCOUNT_ID }}
    JAWS_API_PASSWORD: ${{ secrets.JAWS_API_KEY }}
  run: |
    Import-Module ./JawsDeploySdk.psm1   # github.com/JawsDeploy/powershell-sdk
    New-JawsRelease `
        -projectId       "<project id>" `
        -version         "1.0.${{ github.run_number }}" `
        -packageVersions @{ "Checkout.Web" = "1.0.${{ github.run_number }}" }
```

## Using the REST API instead

If you prefer not to use PowerShell, the REST API takes the same parameters. Use Basic auth with a service account ID and the API key.

## Same outcome, plain curl

```
curl -X POST "https://app.jawsdeploy.net/api/release" \
  -u "$JAWS_API_LOGIN:$JAWS_API_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId":       "<project id>",
    "version":         "1.0.'"$GITHUB_RUN_NUMBER"'",
    "packageVersions": { "Checkout.Web": "1.0.'"$GITHUB_RUN_NUMBER"'" }
  }'
```

> **// Auto-deploy after release creation - Call `Invoke-ReleaseAndDeployProject` instead to create the release and deploy it in one step.**
> 
> This is useful for the first environment in the lifecycle. It waits for the deployment and prints its log. Promote to later environments from Jaws Deploy - keep that decision inside the deployment platform, not in your workflow file.

