diff --git a/.github/workflows/build-services.yml b/.github/workflows/build-services.yml index b5d8eac..4f6e471 100644 --- a/.github/workflows/build-services.yml +++ b/.github/workflows/build-services.yml @@ -36,12 +36,12 @@ jobs: - name: Checkout if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: ref: ${{ steps.setvars.outputs.environment }} - name: Get next version - uses: reecetech/version-increment@2023.9.3 + uses: reecetech/version-increment@a29aa752dc3b8118a2dc2ed93faf0e95a73a9c7e if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} id: version with: @@ -49,14 +49,14 @@ jobs: increment: patch - name: Create Release branch - uses: JamesIves/github-pages-deploy-action@v4 + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} with: branch: release-${{ steps.setvars.outputs.environment }} # The branch the action should deploy to. folder: . # The folder the action should deploy. - name: Checkout Release branch - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} with: ref: release-${{ steps.setvars.outputs.environment }} @@ -80,7 +80,7 @@ jobs: git push - name: Create release - uses: "actions/github-script@v6" + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} env: VERSION: ${{ steps.version.outputs.version }} @@ -160,7 +160,7 @@ jobs: --data @payload.json \ https://app.terraform.io/api/v2/vars - - uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.1.1 + - uses: hashicorp/tfc-workflows-github/actions/upload-configuration@8e08d1ba957673f5fbf971a22b3219639dc45661 id: upload if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} with: @@ -168,7 +168,7 @@ jobs: directory: release - name: Create Apply Run - uses: hashicorp/tfc-workflows-github/actions/create-run@v1.1.1 + uses: hashicorp/tfc-workflows-github/actions/create-run@8e08d1ba957673f5fbf971a22b3219639dc45661 id: apply-run if: ${{ steps.check_state.outputs.initial_deploy_state == 'disabled_manually' }} with: diff --git a/.github/workflows/initial-deploy.yml b/.github/workflows/initial-deploy.yml index f8e7673..6aeafef 100644 --- a/.github/workflows/initial-deploy.yml +++ b/.github/workflows/initial-deploy.yml @@ -15,23 +15,34 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - name: Get next version - uses: reecetech/version-increment@2023.9.3 + uses: reecetech/version-increment@a29aa752dc3b8118a2dc2ed93faf0e95a73a9c7e id: version with: scheme: calver increment: patch + - name: Lookup Project ID + id: lookup_project_id + run: | + curl \ + --header "Authorization: Bearer ${{ secrets.TFE_TOKEN }}" \ + --header "Content-Type: application/vnd.api+json" \ + --request GET \ + --output project_output.txt \ + https://app.terraform.io/api/v2/organizations/${{ github.repository_owner }}/projects + echo "project_id=$(jq -r --arg name '${{ vars.TFE_PROJECT }}' '.data[] | select(.attributes.name | test($name; "i")) | .id' project_output.txt)" >> $GITHUB_OUTPUT + - name: Create Release branch - uses: JamesIves/github-pages-deploy-action@v4 + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f with: branch: release # The branch the action should deploy to. folder: . # The folder the action should deploy. - name: Checkout Release branch - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: ref: release path: release @@ -54,25 +65,33 @@ jobs: - name: Create workspace id: create_workspace_dev run: | - cat > payload.json <> $GITHUB_OUTPUT + cat > payload.json <> $GITHUB_OUTPUT - name: Create workspace id: create_workspace_prod @@ -84,7 +103,15 @@ jobs: "name": "${{ github.event.repository.name }}-prod", "auto-apply": "true" }, - "type": "workspaces" + "type": "workspaces", + "relationships": { + "project": { + "data": { + "type": "projects", + "id": "${{ steps.lookup_project_id.outputs.project_id }}" + } + } + } } } EOF @@ -282,7 +309,7 @@ jobs: https://app.terraform.io/api/v2/vars - name: Create release - uses: "actions/github-script@v6" + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd env: VERSION: ${{ steps.version.outputs.version }} with: @@ -305,20 +332,20 @@ jobs: core.setFailed(error.message); } - - uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.1.1 + - uses: hashicorp/tfc-workflows-github/actions/upload-configuration@8e08d1ba957673f5fbf971a22b3219639dc45661 id: upload_dev with: workspace: ${{ github.event.repository.name }}-dev directory: release - - uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.1.1 + - uses: hashicorp/tfc-workflows-github/actions/upload-configuration@8e08d1ba957673f5fbf971a22b3219639dc45661 id: upload_prod with: workspace: ${{ github.event.repository.name }}-prod directory: release - name: Create Apply Run dev - uses: hashicorp/tfc-workflows-github/actions/create-run@v1.1.1 + uses: hashicorp/tfc-workflows-github/actions/create-run@8e08d1ba957673f5fbf971a22b3219639dc45661 id: apply-run-dev if: success() || failure() with: @@ -327,7 +354,7 @@ jobs: plan_only: false - name: Create Apply Run prod - uses: hashicorp/tfc-workflows-github/actions/create-run@v1.1.1 + uses: hashicorp/tfc-workflows-github/actions/create-run@8e08d1ba957673f5fbf971a22b3219639dc45661 id: apply-run-prod if: success() || failure() with: diff --git a/README.md b/README.md index cc1b312..72b1641 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # pulse-graphql -GraphQL project repo +GraphQL project repo \ No newline at end of file