Skip to content

Commit

Permalink
chore(ci): replace usage of secrets and scripts with actions usage (#288
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rhamzeh authored Jan 26, 2024
2 parents e021223 + cab5d5b commit 563fb24
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 216 deletions.
182 changes: 71 additions & 111 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup git
run: ./scripts/setup_git.sh
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

- name: Clone the existing SDK
run: ./scripts/clone_sdk.sh
env:
GITHUB_ORG_ID: ${{ secrets.JS_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.JS_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.JS_SDK_SSH_KEY }}
SDK_PATH: clients/fga-js-sdk
KNOWN_HOSTS: ${{secrets.KNOWN_HOSTS}}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
repository: openfga/js-sdk
path: clients/fga-js-sdk

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -44,14 +35,15 @@ jobs:
run: make test-client-js

- name: Check for SDK changes
run: ./scripts/commit_push_changes.sh
env:
SDK_PATH: clients/fga-js-sdk
DRY_RUN: 1
TAGGING_DISABLE: 1
GITHUB_ORG_ID: ${{ secrets.JS_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.JS_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.JS_SDK_SSH_KEY }}
run: |
cd clients/fga-js-sdk
if $(git status | grep -q "nothing to commit"); then
echo "CLEAN: no changes found"
exit 0
fi
echo "DIRTY: changes found"
git status
git diff
build-and-test-go-sdk:
runs-on: ubuntu-latest
Expand All @@ -60,21 +52,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup git
run: ./scripts/setup_git.sh
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

- name: Clone the existing SDK
run: ./scripts/clone_sdk.sh
env:
GITHUB_ORG_ID: ${{ secrets.GO_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.GO_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.GO_SDK_SSH_KEY }}
SDK_PATH: clients/fga-go-sdk
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=$tmpdir/known_hosts"
KNOWN_HOSTS: ${{secrets.KNOWN_HOSTS}}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
repository: openfga/go-sdk
path: clients/fga-go-sdk

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -83,14 +65,15 @@ jobs:
run: make test-client-go

- name: Check for SDK changes
run: ./scripts/commit_push_changes.sh
env:
SDK_PATH: clients/fga-go-sdk
DRY_RUN: 1
TAGGING_DISABLE: 1
GITHUB_ORG_ID: ${{ secrets.GO_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.GO_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.GO_SDK_SSH_KEY }}
run: |
cd clients/fga-go-sdk
if $(git status | grep -q "nothing to commit"); then
echo "CLEAN: no changes found"
exit 0
fi
echo "DIRTY: changes found"
git status
git diff
build-and-test-dotnet-sdk:
runs-on: ubuntu-latest
Expand All @@ -99,20 +82,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup git
run: ./scripts/setup_git.sh
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

- name: Clone the existing SDK
run: ./scripts/clone_sdk.sh
env:
GITHUB_ORG_ID: ${{ secrets.DOTNET_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.DOTNET_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.DOTNET_SDK_SSH_KEY }}
SDK_PATH: clients/fga-dotnet-sdk
KNOWN_HOSTS: ${{secrets.KNOWN_HOSTS}}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
repository: openfga/dotnet-sdk
path: clients/fga-dotnet-sdk

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -121,14 +95,16 @@ jobs:
run: make test-client-dotnet

- name: Check for SDK changes
run: ./scripts/commit_push_changes.sh
env:
SDK_PATH: clients/fga-dotnet-sdk
DRY_RUN: 1
TAGGING_DISABLE: 1
GITHUB_ORG_ID: ${{ secrets.DOTNET_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.DOTNET_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.DOTNET_SDK_SSH_KEY }}
run: |
cd clients/fga-dotnet-sdk
if $(git status | grep -q "nothing to commit"); then
echo "CLEAN: no changes found"
exit 0
fi
echo "DIRTY: changes found"
git status
git diff
build-and-test-python-sdk:
runs-on: ubuntu-latest
Expand All @@ -142,20 +118,11 @@ jobs:
with:
python-version: '3.10'

- name: Setup git
run: ./scripts/setup_git.sh
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

- name: Clone the existing SDK
run: ./scripts/clone_sdk.sh
env:
GITHUB_ORG_ID: ${{ secrets.PYTHON_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.PYTHON_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.PYTHON_SDK_SSH_KEY }}
SDK_PATH: clients/fga-python-sdk
KNOWN_HOSTS: ${{secrets.KNOWN_HOSTS}}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
repository: openfga/python-sdk
path: clients/fga-python-sdk

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -165,14 +132,15 @@ jobs:
make test-client-python
- name: Check for SDK changes
run: ./scripts/commit_push_changes.sh
env:
SDK_PATH: clients/fga-python-sdk
DRY_RUN: 1
TAGGING_DISABLE: 1
GITHUB_ORG_ID: ${{ secrets.PYTHON_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.PYTHON_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.PYTHON_SDK_SSH_KEY }}
run: |
cd clients/fga-python-sdk
if $(git status | grep -q "nothing to commit"); then
echo "CLEAN: no changes found"
exit 0
fi
echo "DIRTY: changes found"
git status
git diff
build-and-test-java-sdk:
runs-on: ubuntu-latest
Expand All @@ -188,20 +156,11 @@ jobs:
distribution: 'temurin'
cache: 'gradle'

- name: Setup git
run: ./scripts/setup_git.sh
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

- name: Clone the existing SDK
run: ./scripts/clone_sdk.sh
env:
GITHUB_ORG_ID: ${{ secrets.JAVA_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.JAVA_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.JAVA_SDK_SSH_KEY }}
SDK_PATH: clients/fga-java-sdk
KNOWN_HOSTS: ${{secrets.KNOWN_HOSTS}}
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
repository: openfga/java-sdk
path: clients/fga-java-sdk

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -211,11 +170,12 @@ jobs:
make test-integration-client-java
- name: Check for SDK changes
run: ./scripts/commit_push_changes.sh
env:
SDK_PATH: clients/fga-java-sdk
DRY_RUN: 1
TAGGING_DISABLE: 1
GITHUB_ORG_ID: ${{ secrets.JAVA_SDK_GITHUB_ORG_ID }}
GITHUB_REPO_ID: ${{ secrets.JAVA_SDK_GITHUB_REPO_ID }}
SSH_KEY: ${{ secrets.JAVA_SDK_SSH_KEY }}
run: |
cd clients/fga-java-sdk
if $(git status | grep -q "nothing to commit"); then
echo "CLEAN: no changes found"
exit 0
fi
echo "DIRTY: changes found"
git status
git diff
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,24 +173,8 @@ Note: Semgrep will be automatically enabled - there is nothing you need to do fo

| Key | Comment |
|-----------------------------|-----------------------------------------------------------------------------|
| `KNOWN_HOSTS` | |
| `FOSSA_API_KEY` | FOSSA API Key |
| `SNYK_TOKEN` | Snyk API Key |
| `GO_SDK_GITHUB_ORG_ID` | The GitHub org for the SDK |
| `GO_SDK_GITHUB_REPO_ID` | The GitHub repo id for the SDK |
| `GO_SDK_SSH_KEY` | The SSH private deploy key for the SDK (Not needed after the SDK is public) |
| `JS_SDK_GITHUB_ORG_ID` | The GitHub org for the SDK |
| `JS_SDK_GITHUB_REPO_ID` | The GitHub repo id for the SDK |
| `JS_SDK_SSH_KEY` | The SSH private deploy key for the SDK (Not needed after the SDK is public) |
| `DOTNET_SDK_GITHUB_ORG_ID` | The GitHub org for the SDK |
| `DOTNET_SDK_GITHUB_REPO_ID` | The GitHub repo id for the SDK |
| `DOTNET_SDK_SSH_KEY` | The SSH private deploy key for the SDK (Not needed after the SDK is public) |
| `PYTHON_SDK_GITHUB_ORG_ID` | The GitHub org for the SDK |
| `PYTHON_SDK_GITHUB_REPO_ID` | The GitHub repo id for the SDK |
| `PYTHON_SDK_SSH_KEY` | The SSH private deploy key for the SDK (Not needed after the SDK is public) |
| `JAVA_SDK_GITHUB_ORG_ID` | The GitHub org for the SDK |
| `JAVA_SDK_GITHUB_REPO_ID` | The GitHub repo id for the SDK |
| `JAVA_SDK_SSH_KEY` | The SSH private deploy key for the SDK (Not needed after the SDK is public) |

## Contributing
Please review the [Contributing Guidelines](https://github.com/openfga/.github/blob/main/CONTRIBUTING.md) before sending a PR or opening an issue.
Expand Down
9 changes: 0 additions & 9 deletions scripts/clone_sdk.sh

This file was deleted.

68 changes: 0 additions & 68 deletions scripts/commit_push_changes.sh

This file was deleted.

4 changes: 0 additions & 4 deletions scripts/setup_git.sh

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/setup_gpg_key.sh

This file was deleted.

0 comments on commit 563fb24

Please sign in to comment.