Skip to content

Commit

Permalink
add sync deployment approval script
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmycallin committed Apr 4, 2024
1 parent caac5d8 commit 89f0d7d
Show file tree
Hide file tree
Showing 23 changed files with 3,550 additions and 55 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: CD

on:
push:
tags:
- "v*"
workflow_call:
secrets:
token:
Expand Down
52 changes: 47 additions & 5 deletions .github/workflows/release-base.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Release notes

on:
release:
types:
- released

workflow_call:
inputs:
action:
type: string
description: "create-release | pre-deploy | post-deploy"
required: true
secrets:
ftrackApiKey:
description: "The API key to the ftrack instance"
Expand All @@ -15,9 +16,10 @@ on:
required: true

jobs:
sync-release:
create-release:
timeout-minutes: 5
name: Sync release in ftrack
if: inputs.action == 'create-release'
runs-on: ubuntu-latest
steps:
# required so we can reference the actions locally
Expand All @@ -38,3 +40,43 @@ jobs:
ftrackUserId: "76a40852-359d-11ed-8012-aab5768efa1e"
ftrackApiKey: ${{ secrets.ftrackApiKey || secrets.FTRACK_API_KEY }}
token: ${{ secrets.token || secrets.GITHUB_TOKEN }}

pre-deploy:
timeout-minutes: 5
name: Create change request in ftrack
if: inputs.action == 'pre-deploy'
runs-on: ubuntu-latest
steps:
# required so we can reference the actions locally
- name: Checkout workflows repo
uses: actions/checkout@v3
with:
# you can set this to your branch when modifying actions and want too assert that it works
# ref: update-tasks-with-release-tag
path: workflows
repository: ftrackhq/ftrack-actions
token: ${{ secrets.token || secrets.GITHUB_TOKEN }}
- name: ftrack Sync
uses: ./workflows/actions/ftrack-sync
with:
action: "pre-deploy"

post-deploy:
timeout-minutes: 5
name: Sync approval of change request in ftrack
if: inputs.action == 'post-deploy'
runs-on: ubuntu-latest
steps:
# required so we can reference the actions locally
- name: Checkout workflows repo
uses: actions/checkout@v3
with:
# you can set this to your branch when modifying actions and want too assert that it works
# ref: update-tasks-with-release-tag
path: workflows
repository: ftrackhq/ftrack-actions
token: ${{ secrets.token || secrets.GITHUB_TOKEN }}
- name: ftrack Sync
uses: ./workflows/actions/ftrack-sync
with:
action: "post-deploy"
6 changes: 6 additions & 0 deletions actions/ftrack-sync/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ inputs:
context:
required: false
description: "Additional context required for actions in JSON format"
default: "{}"
runs:
using: "composite"
steps:
Expand All @@ -35,6 +36,11 @@ runs:
id: PR
with:
sha: ${{ github.event.pull_request.head.sha }}
- name: "dump pr context"
shell: bash
env:
PR_PAYLOAD: ${{ steps.PR.outputs.pr }}
run: echo $PR_PAYLOAD
- name: bun run ${{ inputs.action }}
working-directory: ${{ github.action_path }}
shell: bash
Expand Down
Binary file modified actions/ftrack-sync/bun.lockb
Binary file not shown.
4 changes: 0 additions & 4 deletions actions/ftrack-sync/check_tasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe("ftrack sync", () => {
assertTasksHaveProductFieldSet({
body: "Resolves FT-123a",
draft: false,
merged_at: "",
state: "",
}),
).rejects.toThrow(
Expand Down Expand Up @@ -65,7 +64,6 @@ describe("ftrack sync", () => {
assertTasksHaveProductFieldSet({
body: "Resolves FT-123a",
draft: false,
merged_at: "",
state: "",
}),
).resolves.not.toThrow();
Expand Down Expand Up @@ -97,7 +95,6 @@ describe("ftrack sync", () => {
assertTasksHaveProductFieldSet({
body: "Resolves FT-123a",
draft: false,
merged_at: "",
state: "",
}),
).resolves.not.toThrow();
Expand Down Expand Up @@ -127,7 +124,6 @@ describe("ftrack sync", () => {
assertTasksHaveProductFieldSet({
body: "Resolves FT-123a",
draft: false,
merged_at: "",
state: "",
}),
).resolves.not.toThrow();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
{
"token": "***",
"job": "deploy-sync",
"ref": "refs/tags/v0.0.0-test.15",
"sha": "9e521a4e60424553524775f96adef907d91b4d29",
"repository": "ftrackhq/ftrack-actions",
"repository_owner": "ftrackhq",
"repository_owner_id": "104374742",
"repositoryUrl": "git://github.com/ftrackhq/ftrack-actions.git",
"run_id": "8360537201",
"run_number": "284",
"retention_days": "60",
"run_attempt": "1",
"artifact_cache_size_limit": "10",
"repository_visibility": "public",
"repo-self-hosted-runners-disabled": false,
"enterprise-managed-business-id": "",
"repository_id": "542238290",
"actor_id": "2225828",
"actor": "jimmycallin",
"triggering_actor": "jimmycallin",
"workflow": "PR",
"head_ref": "",
"base_ref": "",
"event_name": "push",
"event": {
"after": "9e521a4e60424553524775f96adef907d91b4d29",
"base_ref": "refs/heads/release-2",
"before": "0000000000000000000000000000000000000000",
"commits": [],
"compare": "https://github.com/ftrackhq/ftrack-actions/compare/v0.0.0-test.15",
"created": true,
"deleted": false,
"enterprise": {
"avatar_url": "https://avatars.githubusercontent.com/b/12197?v=4",
"created_at": "2022-03-24T16:40:19Z",
"description": "",
"html_url": "https://github.com/enterprises/backlight",
"id": 12197,
"name": "Backlight",
"node_id": "E_kgDNL6U",
"slug": "backlight",
"updated_at": "2024-03-18T14:28:04Z",
"website_url": "https://www.backlight.co/"
},
"forced": false,
"head_commit": {
"author": {
"email": "jimmy.callin@gmail.com",
"name": "Jimmy Callin",
"username": "jimmycallin"
},
"committer": {
"email": "jimmy.callin@gmail.com",
"name": "Jimmy Callin",
"username": "jimmycallin"
},
"distinct": true,
"id": "9e521a4e60424553524775f96adef907d91b4d29",
"message": "wip",
"timestamp": "2024-03-20T15:20:30+01:00",
"tree_id": "2cbb3b0693480d86d5897715463cf86a1389a69f",
"url": "https://github.com/ftrackhq/ftrack-actions/commit/9e521a4e60424553524775f96adef907d91b4d29"
},
"organization": {
"avatar_url": "https://avatars.githubusercontent.com/u/104374742?v=4",
"description": "",
"events_url": "https://api.github.com/orgs/ftrackhq/events",
"hooks_url": "https://api.github.com/orgs/ftrackhq/hooks",
"id": 104374742,
"issues_url": "https://api.github.com/orgs/ftrackhq/issues",
"login": "ftrackhq",
"members_url": "https://api.github.com/orgs/ftrackhq/members{/member}",
"node_id": "O_kgDOBjih1g",
"public_members_url": "https://api.github.com/orgs/ftrackhq/public_members{/member}",
"repos_url": "https://api.github.com/orgs/ftrackhq/repos",
"url": "https://api.github.com/orgs/ftrackhq"
},
"pusher": {
"email": "jimmy@callin.cc",
"name": "jimmycallin"
},
"ref": "refs/tags/v0.0.0-test.15",
"repository": {
"allow_forking": true,
"archive_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/assignees{/user}",
"blobs_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/branches{/branch}",
"clone_url": "https://github.com/ftrackhq/ftrack-actions.git",
"collaborators_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/comments{/number}",
"commits_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/commits{/sha}",
"compare_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/contents/{+path}",
"contributors_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/contributors",
"created_at": 1664304175,
"custom_properties": {},
"default_branch": "main",
"deployments_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/deployments",
"description": "Shared GitHub Actions used in ftrack repositories.",
"disabled": false,
"downloads_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/downloads",
"events_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/events",
"fork": false,
"forks": 0,
"forks_count": 0,
"forks_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/forks",
"full_name": "ftrackhq/ftrack-actions",
"git_commits_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/git/tags{/sha}",
"git_url": "git://github.com/ftrackhq/ftrack-actions.git",
"has_discussions": false,
"has_downloads": true,
"has_issues": true,
"has_pages": false,
"has_projects": false,
"has_wiki": false,
"homepage": null,
"hooks_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/hooks",
"html_url": "https://github.com/ftrackhq/ftrack-actions",
"id": 542238290,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/issues/events{/number}",
"issues_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/issues{/number}",
"keys_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/keys{/key_id}",
"labels_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/labels{/name}",
"language": "TypeScript",
"languages_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/languages",
"license": {
"key": "apache-2.0",
"name": "Apache License 2.0",
"node_id": "MDc6TGljZW5zZTI=",
"spdx_id": "Apache-2.0",
"url": "https://api.github.com/licenses/apache-2.0"
},
"master_branch": "main",
"merges_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/merges",
"milestones_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/milestones{/number}",
"mirror_url": null,
"name": "ftrack-actions",
"node_id": "R_kgDOIFHmUg",
"notifications_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/notifications{?since,all,participating}",
"open_issues": 1,
"open_issues_count": 1,
"organization": "ftrackhq",
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/104374742?v=4",
"email": null,
"events_url": "https://api.github.com/users/ftrackhq/events{/privacy}",
"followers_url": "https://api.github.com/users/ftrackhq/followers",
"following_url": "https://api.github.com/users/ftrackhq/following{/other_user}",
"gists_url": "https://api.github.com/users/ftrackhq/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/ftrackhq",
"id": 104374742,
"login": "ftrackhq",
"name": "ftrackhq",
"node_id": "O_kgDOBjih1g",
"organizations_url": "https://api.github.com/users/ftrackhq/orgs",
"received_events_url": "https://api.github.com/users/ftrackhq/received_events",
"repos_url": "https://api.github.com/users/ftrackhq/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/ftrackhq/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ftrackhq/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/ftrackhq"
},
"private": false,
"pulls_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/pulls{/number}",
"pushed_at": 1710944440,
"releases_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/releases{/id}",
"size": 4407,
"ssh_url": "git@github.com:ftrackhq/ftrack-actions.git",
"stargazers": 0,
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/stargazers",
"statuses_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/subscribers",
"subscription_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/subscription",
"svn_url": "https://github.com/ftrackhq/ftrack-actions",
"tags_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/tags",
"teams_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/ftrackhq/ftrack-actions/git/trees{/sha}",
"updated_at": "2023-04-26T15:28:07Z",
"url": "https://github.com/ftrackhq/ftrack-actions",
"visibility": "public",
"watchers": 0,
"watchers_count": 0,
"web_commit_signoff_required": false
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/2225828?v=4",
"events_url": "https://api.github.com/users/jimmycallin/events{/privacy}",
"followers_url": "https://api.github.com/users/jimmycallin/followers",
"following_url": "https://api.github.com/users/jimmycallin/following{/other_user}",
"gists_url": "https://api.github.com/users/jimmycallin/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/jimmycallin",
"id": 2225828,
"login": "jimmycallin",
"node_id": "MDQ6VXNlcjIyMjU4Mjg=",
"organizations_url": "https://api.github.com/users/jimmycallin/orgs",
"received_events_url": "https://api.github.com/users/jimmycallin/received_events",
"repos_url": "https://api.github.com/users/jimmycallin/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/jimmycallin/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jimmycallin/subscriptions",
"type": "User",
"url": "https://api.github.com/users/jimmycallin"
}
},
"server_url": "https://github.com",
"api_url": "https://api.github.com",
"graphql_url": "https://api.github.com/graphql",
"ref_name": "v0.0.0-test.15",
"ref_protected": false,
"ref_type": "tag",
"secret_source": "Actions",
"workflow_ref": "ftrackhq/ftrack-actions/.github/workflows/pr-base.yml@refs/tags/v0.0.0-test.15",
"workflow_sha": "9e521a4e60424553524775f96adef907d91b4d29",
"workspace": "/home/runner/work/ftrack-actions/ftrack-actions",
"action": "__self",
"event_path": "/home/runner/work/_temp/_github_workflow/event.json",
"action_repository": "",
"action_ref": "",
"path": "/home/runner/work/_temp/_runner_file_commands/add_path_f36b5be0-acbc-47df-9cbc-8ff3fd85bb03",
"env": "/home/runner/work/_temp/_runner_file_commands/set_env_f36b5be0-acbc-47df-9cbc-8ff3fd85bb03",
"step_summary": "/home/runner/work/_temp/_runner_file_commands/step_summary_f36b5be0-acbc-47df-9cbc-8ff3fd85bb03",
"state": "/home/runner/work/_temp/_runner_file_commands/save_state_f36b5be0-acbc-47df-9cbc-8ff3fd85bb03",
"output": "/home/runner/work/_temp/_runner_file_commands/set_output_f36b5be0-acbc-47df-9cbc-8ff3fd85bb03",
"action_path": "/home/runner/work/ftrack-actions/ftrack-actions/./workflows/actions/ftrack-sync",
"action_status": "success"
}

0 comments on commit 89f0d7d

Please sign in to comment.