Merge pull request #3 from outerbounds/feat/from-obproject-toml #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Project | |
| on: | |
| push: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| delete: | |
| branches-ignore: [main] | |
| env: | |
| GH_HEAD_REF: ${{ github.head_ref }} | |
| GH_REF: ${{ github.ref_name }} | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| deploy: | |
| if: github.event_name != 'delete' && !(github.event_name == 'pull_request' && github.event.action == 'closed') | |
| name: Deploy Project | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: pip install outerbounds ob-project-utils | |
| - name: Configure Outerbounds | |
| run: | | |
| outerbounds service-principal-configure \ | |
| --from-obproject-toml \ | |
| --github-actions | |
| - name: Deploy Project | |
| run: obproject-deploy | |
| env: | |
| PYTHONUNBUFFERED: "1" | |
| teardown: | |
| if: > | |
| (github.event_name == 'delete') || | |
| (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) | |
| name: Teardown Branch | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: pip install outerbounds ob-project-utils | |
| - name: Configure Outerbounds | |
| run: | | |
| outerbounds service-principal-configure \ | |
| --from-obproject-toml \ | |
| --github-actions | |
| - name: Teardown branch resources | |
| run: | | |
| BRANCH=${{ github.head_ref || github.event.ref }} | |
| PROJECT=$(python3 -c " | |
| try: | |
| import tomllib | |
| except ImportError: | |
| import toml as tomllib | |
| print(tomllib.load(open('obproject.toml','rb'))['project']) | |
| ") | |
| echo "Tearing down $PROJECT/$BRANCH" | |
| outerbounds flowproject teardown-branch \ | |
| --id "$PROJECT/$BRANCH" --yes -o json |