diff --git a/.github/workflows/new_version_triggers.yml b/.github/workflows/new_version_triggers.yml deleted file mode 100644 index 5e97d515a75..00000000000 --- a/.github/workflows/new_version_triggers.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by internal/ci/ci_tool.cue; do not edit - -name: New release triggers -"on": - push: - tags: - - v* -jobs: - push: - runs-on: ubuntu-18.04 - defaults: - run: - shell: bash - steps: - - name: Rebuild tip.cuelang.org - run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches' - - name: Trigger unity build - run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Check against CUE ${GITHUB_REF##refs/tags/}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"${GITHUB_REF##refs/tags/}\\\"\"}}}" https://api.github.com/repos/cue-lang/unity/dispatches' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cd82328232..6ae4811c0a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,3 +38,7 @@ jobs: version: v1.1.0 env: GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} + - name: Re-test cuelang.org + run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches' + - name: Trigger unity build + run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Check against CUE ${GITHUB_REF##refs/tags/}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"${GITHUB_REF##refs/tags/}\\\"\"}}}" https://api.github.com/repos/cue-lang/unity/dispatches' diff --git a/cmd/cue/cmd/testdata/script/cmd_github.txt b/cmd/cue/cmd/testdata/script/cmd_github.txt index bb01c0ce324..a8b06b6c0ce 100644 --- a/cmd/cue/cmd/testdata/script/cmd_github.txt +++ b/cmd/cue/cmd/testdata/script/cmd_github.txt @@ -11,7 +11,6 @@ cue cmd genworkflows # TODO: drop cd when we solve cuelang.org/issue/708 cd ../../ -cmp .github/workflows/new_version_triggers.yml .github/workflows/new_version_triggers.yml.golden cmp .github/workflows/release.yml .github/workflows/release.yml.golden cmp .github/workflows/repository_dispatch.yml .github/workflows/repository_dispatch.yml.golden cmp .github/workflows/test.yml .github/workflows/test.yml.golden @@ -107,6 +106,10 @@ jobs: version: v1.1.0 env: GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} + - name: Re-test cuelang.org + run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches' + - name: Trigger unity build + run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Check against CUE ${GITHUB_REF##refs/tags/}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"${GITHUB_REF##refs/tags/}\\\"\"}}}" https://api.github.com/repos/cue-lang/unity/dispatches' -- .github/workflows/repository_dispatch.yml.golden -- # Generated by internal/ci/ci_tool.cue; do not edit @@ -1119,9 +1122,6 @@ workflows: [...{ }, { file: "tip_triggers.yml" schema: tip_triggers -}, { - file: "new_version_triggers.yml" - schema: new_version_triggers }] test: _#bashWorkflow & { name: "Test" @@ -1281,24 +1281,19 @@ release: _#bashWorkflow & { args: "release --rm-dist" version: "v1.1.0" } - }] - } -} -tip_triggers: _#bashWorkflow & { - name: "Push to tip triggers" - on: push: branches: [_#masterBranch] - jobs: push: { - "runs-on": _#linuxMachine - steps: [{ - name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" - }, { + }, _#step & { _#arg: { - event_type: "Check against ${GITHUB_SHA}" + event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" + } + name: "Re-test cuelang.org" + run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" + }, _#step & { + _#arg: { + event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" client_payload: { type: "unity" payload: versions: """ - "commit:${GITHUB_SHA}" + "${GITHUB_REF##refs/tags/}" """ } } @@ -1307,24 +1302,21 @@ tip_triggers: _#bashWorkflow & { }] } } -new_version_triggers: _#bashWorkflow & { - name: "New release triggers" - on: push: tags: [_#releaseTagPattern] +tip_triggers: _#bashWorkflow & { + name: "Push to tip triggers" + on: push: branches: [_#masterBranch] jobs: push: { "runs-on": _#linuxMachine steps: [{ - _#arg: { - event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" - } name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" + run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" }, { _#arg: { - event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" + event_type: "Check against ${GITHUB_SHA}" client_payload: { type: "unity" payload: versions: """ - "${GITHUB_REF##refs/tags/}" + "commit:${GITHUB_SHA}" """ } } diff --git a/cue/testdata/eval/github.txtar b/cue/testdata/eval/github.txtar index d48f07d249f..e0290670ce5 100644 --- a/cue/testdata/eval/github.txtar +++ b/cue/testdata/eval/github.txtar @@ -32,9 +32,6 @@ workflows: [...{ }, { file: "tip_triggers.yml" schema: tip_triggers -}, { - file: "new_version_triggers.yml" - schema: new_version_triggers }] test: _#bashWorkflow & { name: "Test" @@ -194,24 +191,19 @@ release: _#bashWorkflow & { args: "release --rm-dist" version: "v1.1.0" } - }] - } -} -tip_triggers: _#bashWorkflow & { - name: "Push to tip triggers" - on: push: branches: [_#masterBranch] - jobs: push: { - "runs-on": _#linuxMachine - steps: [{ - name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" - }, { + }, _#step & { _#arg: { - event_type: "Check against ${GITHUB_SHA}" + event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" + } + name: "Re-test cuelang.org" + run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" + }, _#step & { + _#arg: { + event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" client_payload: { type: "unity" payload: versions: """ - "commit:${GITHUB_SHA}" + "${GITHUB_REF##refs/tags/}" """ } } @@ -220,24 +212,21 @@ tip_triggers: _#bashWorkflow & { }] } } -new_version_triggers: _#bashWorkflow & { - name: "New release triggers" - on: push: tags: [_#releaseTagPattern] +tip_triggers: _#bashWorkflow & { + name: "Push to tip triggers" + on: push: branches: [_#masterBranch] jobs: push: { "runs-on": _#linuxMachine steps: [{ - _#arg: { - event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" - } name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" + run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" }, { _#arg: { - event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" + event_type: "Check against ${GITHUB_SHA}" client_payload: { type: "unity" payload: versions: """ - "${GITHUB_REF##refs/tags/}" + "commit:${GITHUB_SHA}" """ } } @@ -1246,7 +1235,7 @@ import "strings" } res: (_|_){ // [incomplete] invalid interpolation: cannot convert incomplete value "string" to JSON: - // ./workflows.cue:130:9 + // ./workflows.cue:127:9 } } } @@ -1322,7 +1311,7 @@ import "strings" _#type(:ci): (string){ string } if: (_|_){ // [incomplete] workflows.1.schema._#dispatchJob.if: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:141:14 + // ./workflows.cue:138:14 } } name: (string){ "Repository Dispatch" } @@ -1419,6 +1408,26 @@ import "strings" version: (string){ "v1.1.0" } } } + 6: (#struct){ + _#arg(:ci): (#struct){ + event_type: (string){ "Re-test post release of ${GITHUB_REF##refs/tags/}" } + } + name: (string){ "Re-test cuelang.org" } + run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } + } + 7: (#struct){ + _#arg(:ci): (#struct){ + event_type: (string){ "Check against CUE ${GITHUB_REF##refs/tags/}" } + client_payload: (#struct){ + type: (string){ "unity" } + payload: (#struct){ + versions: (string){ "\"${GITHUB_REF##refs/tags/}\"" } + } + } + } + name: (string){ "Trigger unity build" } + run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-lang/unity/dispatches" } + } } defaults: (#struct){ run: (#struct){ @@ -1517,89 +1526,6 @@ import "strings" } } } - 4: (struct){ - file: (string){ "new_version_triggers.yml" } - schema: (#struct){ - #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } - #branch: (list){ - 0: (string){ strings.MinRunes(1) } - } - #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ - }, (list){ - }) } - #container: (#struct){ - image: (string){ string } - } - #defaults: (#struct){ - } - #env: (#struct){ - } - #environment: (#struct){ - name: (string){ string } - } - #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } - #eventObject: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } - #globs: (list){ - 0: (string){ strings.MinRunes(1) } - } - #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } - #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } - #path: (list){ - 0: (string){ strings.MinRunes(1) } - } - #ref: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } - #types: (list){ - 0: (_){ _ } - } - #: (#struct){ - "working-directory": (string){ string } - } - jobs: (#struct){ - push: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - steps: (#list){ - 0: (#struct){ - _#arg(:ci): (#struct){ - event_type: (string){ "Re-test post release of ${GITHUB_REF##refs/tags/}" } - } - name: (string){ "Rebuild tip.cuelang.org" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } - } - 1: (#struct){ - _#arg(:ci): (#struct){ - event_type: (string){ "Check against CUE ${GITHUB_REF##refs/tags/}" } - client_payload: (#struct){ - type: (string){ "unity" } - payload: (#struct){ - versions: (string){ "\"${GITHUB_REF##refs/tags/}\"" } - } - } - } - name: (string){ "Trigger unity build" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-lang/unity/dispatches" } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - } - name: (string){ "New release triggers" } - on: (#struct){ - push: (#struct){ - tags: (#list){ - 0: (string){ "v*" } - } - } - } - } - } } test: (#struct){ #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } @@ -1826,7 +1752,7 @@ import "strings" } res: (_|_){ // [incomplete] invalid interpolation: cannot convert incomplete value "string" to JSON: - // ./workflows.cue:130:9 + // ./workflows.cue:127:9 } } } @@ -1899,7 +1825,7 @@ import "strings" _#type(:ci): (string){ string } if: (_|_){ // [incomplete] repository_dispatch._#dispatchJob.if: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:141:14 + // ./workflows.cue:138:14 } } name: (string){ "Repository Dispatch" } @@ -1993,6 +1919,26 @@ import "strings" version: (string){ "v1.1.0" } } } + 6: (#struct){ + _#arg(:ci): (#struct){ + event_type: (string){ "Re-test post release of ${GITHUB_REF##refs/tags/}" } + } + name: (string){ "Re-test cuelang.org" } + run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } + } + 7: (#struct){ + _#arg(:ci): (#struct){ + event_type: (string){ "Check against CUE ${GITHUB_REF##refs/tags/}" } + client_payload: (#struct){ + type: (string){ "unity" } + payload: (#struct){ + versions: (string){ "\"${GITHUB_REF##refs/tags/}\"" } + } + } + } + name: (string){ "Trigger unity build" } + run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-lang/unity/dispatches" } + } } defaults: (#struct){ run: (#struct){ @@ -2087,86 +2033,6 @@ import "strings" } } } - new_version_triggers: (#struct){ - #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } - #branch: (list){ - 0: (string){ strings.MinRunes(1) } - } - #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ - }, (list){ - }) } - #container: (#struct){ - image: (string){ string } - } - #defaults: (#struct){ - } - #env: (#struct){ - } - #environment: (#struct){ - name: (string){ string } - } - #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } - #eventObject: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } - #globs: (list){ - 0: (string){ strings.MinRunes(1) } - } - #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } - #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } - #path: (list){ - 0: (string){ strings.MinRunes(1) } - } - #ref: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } - #types: (list){ - 0: (_){ _ } - } - #: (#struct){ - "working-directory": (string){ string } - } - jobs: (#struct){ - push: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - steps: (#list){ - 0: (#struct){ - _#arg(:ci): (#struct){ - event_type: (string){ "Re-test post release of ${GITHUB_REF##refs/tags/}" } - } - name: (string){ "Rebuild tip.cuelang.org" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } - } - 1: (#struct){ - _#arg(:ci): (#struct){ - event_type: (string){ "Check against CUE ${GITHUB_REF##refs/tags/}" } - client_payload: (#struct){ - type: (string){ "unity" } - payload: (#struct){ - versions: (string){ "\"${GITHUB_REF##refs/tags/}\"" } - } - } - } - name: (string){ "Trigger unity build" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-lang/unity/dispatches" } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - } - name: (string){ "New release triggers" } - on: (#struct){ - push: (#struct){ - tags: (#list){ - 0: (string){ "v*" } - } - } - } - } _#bashWorkflow(:ci): (#struct){ #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } #branch: (list){ @@ -2258,7 +2124,7 @@ import "strings" name: (string){ "Set go build tags" } run: (_|_){ // [incomplete] _#setGoBuildTags.run: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:272:10 + // ./workflows.cue:261:10 } } _#installGo(:ci): (#struct){ @@ -2339,10 +2205,6 @@ import "strings" file: "tip_triggers.yml" schema: 〈2;tip_triggers〉 }, - { - file: "new_version_triggers.yml" - schema: 〈2;new_version_triggers〉 - }, ]) test: (〈0;_#bashWorkflow〉 & { name: "Test" @@ -2544,50 +2406,36 @@ import "strings" version: "v1.1.0" } }), - ] - } - } - }) - tip_triggers: (〈0;_#bashWorkflow〉 & { - name: "Push to tip triggers" - on: { - push: { - branches: [ - 〈4;_#masterBranch〉, - ] - } - } - jobs: { - push: { - "runs-on": 〈3;_#linuxMachine〉 - steps: [ - { - name: "Rebuild tip.cuelang.org" - run: "\(〈5;_#curl〉) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" - }, - { + (〈4;_#step〉 & { _#arg: { - event_type: "Check against ${GITHUB_SHA}" + event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" + } + name: "Re-test cuelang.org" + run: "\(〈5;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;_#arg〉))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" + }), + (〈4;_#step〉 & { + _#arg: { + event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" client_payload: { type: "unity" payload: { - versions: "\"commit:${GITHUB_SHA}\"" + versions: "\"${GITHUB_REF##refs/tags/}\"" } } } name: "Trigger unity build" run: "\(〈5;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;_#arg〉))) https://api.github.com/repos/cue-lang/unity/dispatches" - }, + }), ] } } }) - new_version_triggers: (〈0;_#bashWorkflow〉 & { - name: "New release triggers" + tip_triggers: (〈0;_#bashWorkflow〉 & { + name: "Push to tip triggers" on: { push: { - tags: [ - 〈4;_#releaseTagPattern〉, + branches: [ + 〈4;_#masterBranch〉, ] } } @@ -2596,19 +2444,16 @@ import "strings" "runs-on": 〈3;_#linuxMachine〉 steps: [ { - _#arg: { - event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" - } name: "Rebuild tip.cuelang.org" - run: "\(〈5;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;_#arg〉))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" + run: "\(〈5;_#curl〉) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" }, { _#arg: { - event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" + event_type: "Check against ${GITHUB_SHA}" client_payload: { type: "unity" payload: { - versions: "\"${GITHUB_REF##refs/tags/}\"" + versions: "\"commit:${GITHUB_SHA}\"" } } } diff --git a/internal/ci/workflows.cue b/internal/ci/workflows.cue index 101c8856096..8f10aaf37ed 100644 --- a/internal/ci/workflows.cue +++ b/internal/ci/workflows.cue @@ -43,10 +43,6 @@ workflows: [ file: "tip_triggers.yml" schema: tip_triggers }, - { - file: "new_version_triggers.yml" - schema: new_version_triggers - }, ] test: _#bashWorkflow & { @@ -224,66 +220,58 @@ release: _#bashWorkflow & { name: "Release" on: push: tags: [_#releaseTagPattern] - jobs: { - goreleaser: { - "runs-on": _#linuxMachine - steps: [ - _#checkoutCode & { - with: "fetch-depth": 0 - }, - _#installGo & { - with: "go-version": _#latestStableGo - }, - _#step & { - name: "Setup qemu" - uses: "docker/setup-qemu-action@v1" - }, - _#step & { - name: "Set up Docker Buildx" - uses: "docker/setup-buildx-action@v1" - }, - _#step & { - name: "Docker Login" - uses: "docker/login-action@v1" - with: { - registry: "docker.io" - username: "cueckoo" - password: "${{ secrets.CUECKOO_DOCKER_PAT }}" - } - }, - _#step & { - name: "Run GoReleaser" - env: GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" - uses: "goreleaser/goreleaser-action@v2" - with: { - args: "release --rm-dist" - version: "v1.1.0" - } - }, - ] - } - } -} - -tip_triggers: _#bashWorkflow & { - - name: "Push to tip triggers" - on: push: branches: [_#masterBranch] - jobs: push: { + jobs: goreleaser: { "runs-on": _#linuxMachine steps: [ - { - name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" + _#checkoutCode & { + with: "fetch-depth": 0 }, - { + _#installGo & { + with: "go-version": _#latestStableGo + }, + _#step & { + name: "Setup qemu" + uses: "docker/setup-qemu-action@v1" + }, + _#step & { + name: "Set up Docker Buildx" + uses: "docker/setup-buildx-action@v1" + }, + _#step & { + name: "Docker Login" + uses: "docker/login-action@v1" + with: { + registry: "docker.io" + username: "cueckoo" + password: "${{ secrets.CUECKOO_DOCKER_PAT }}" + } + }, + _#step & { + name: "Run GoReleaser" + env: GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" + uses: "goreleaser/goreleaser-action@v2" + with: { + args: "release --rm-dist" + version: "v1.1.0" + } + }, + _#step & { _#arg: { - event_type: "Check against ${GITHUB_SHA}" + event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" + } + name: "Re-test cuelang.org" + run: #""" + \#(_#curl) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \#(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches + """# + }, + _#step & { + _#arg: { + event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" client_payload: { type: "unity" payload: { versions: """ - "commit:${GITHUB_SHA}" + "${GITHUB_REF##refs/tags/}" """ } } @@ -297,30 +285,25 @@ tip_triggers: _#bashWorkflow & { } } -new_version_triggers: _#bashWorkflow & { +tip_triggers: _#bashWorkflow & { - name: "New release triggers" - on: push: tags: [_#releaseTagPattern] + name: "Push to tip triggers" + on: push: branches: [_#masterBranch] jobs: push: { "runs-on": _#linuxMachine steps: [ { - _#arg: { - event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" - } name: "Rebuild tip.cuelang.org" - run: #""" - \#(_#curl) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \#(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches - """# + run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" }, { _#arg: { - event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" + event_type: "Check against ${GITHUB_SHA}" client_payload: { type: "unity" payload: { versions: """ - "${GITHUB_REF##refs/tags/}" + "commit:${GITHUB_SHA}" """ } }