Skip to content

Commit

Permalink
create-environment gha
Browse files Browse the repository at this point in the history
  • Loading branch information
pitiscarf committed Nov 18, 2024
1 parent 9bce7c9 commit 8531b24
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/wip-create-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Destroy environment

on:
create:
workflow_dispatch:
push:
branches: # TODO: remove me
- 3577-app

defaults:
run:
working-directory: devops/scripts

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"

- name: Get environment name
id: env_name
run: |
env_name=$(node get-environment-name.js ${{ github.event.ref }})
echo "env_name: $env_name"
echo "env_name=$env_name" >> $GITHUB_OUTPUT
- name: Create environment
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
run: node create-environment.js ${{ steps.env_name.outputs.env_name }}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
run: node destroy-environment.js snu-custom ${{ steps.env_name.outputs.env_name }}
run: node destroy-environment.js ${{ steps.env_name.outputs.env_name }}
10 changes: 5 additions & 5 deletions devops/scripts/create-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class CreateEnvironment {
},
});

await this.scaleway.action(RESOURCE.Container, container.id, "deploy");
// await this.scaleway.action(RESOURCE.Container, container.id, "deploy");

container = await this.scaleway.waitUntilSuccess(
RESOURCE.Container,
container.id
);
// container = await this.scaleway.waitUntilSuccess(
// RESOURCE.Container,
// container.id
// );

return container;
}
Expand Down

0 comments on commit 8531b24

Please sign in to comment.