Skip to content

Commit cc83f87

Browse files
File sync from hanakai-rb/repo-sync
Updated files: - .github/workflows/ci.yml
1 parent 307783f commit cc83f87

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,35 @@ jobs:
7676
runs-on: ubuntu-latest
7777
if: github.ref_type == 'tag'
7878
needs: tests
79-
env:
80-
GITHUB_LOGIN: dry-bot
81-
GITHUB_TOKEN: ${{secrets.GH_PAT}}
8279
steps:
83-
- uses: actions/checkout@v3
84-
- name: Install package dependencies
85-
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
86-
- name: Set up Ruby
87-
uses: ruby/setup-ruby@v1
88-
with:
89-
ruby-version: 3.3
90-
- name: Install dependencies
91-
run: gem install ossy --no-document
9280
- name: Trigger release workflow
93-
run: |
94-
tag=$(echo $GITHUB_REF | cut -d / -f 3)
95-
ossy gh w dry-rb/devtools release --payload "{\"tag\":\"$tag\",\"sha\":\"${{github.sha}}\",\"tag_creator\":\"$GITHUB_ACTOR\",\"repo\":\"$GITHUB_REPOSITORY\",\"repo_name\":\"${{github.event.repository.name}}\"}"
81+
uses: actions/github-script@v7
82+
with:
83+
github-token: ${{ secrets.RELEASE_MACHINE_DISPATCH_TOKEN }}
84+
script: |
85+
const tag = context.ref.replace("refs/tags/", "");
86+
const repo = context.repo.owner + "/" + context.repo.repo;
87+
88+
const tagMessage = await github.rest.git.getTag({
89+
owner: context.repo.owner,
90+
repo: context.repo.repo,
91+
tag_sha: context.sha
92+
}).then(res => res.data.message).catch(() => "");
93+
const announce = /(skip-announce|no-announce)/i.test(tagMessage) ? "false" : "true";
94+
95+
await github.rest.actions.createWorkflowDispatch({
96+
owner: "hanakai-rb",
97+
repo: "release-machine",
98+
workflow_id: "release.yml",
99+
ref: "main",
100+
inputs: { repo, tag, announce }
101+
});
102+
103+
const workflowUrl = "https://github.com/hanakai-rb/release-machine/actions/workflows/release.yml";
104+
await core.summary
105+
.addHeading("Release Triggered")
106+
.addRaw(`Triggered release workflow for <code>${tag}</code>`)
107+
.addLink("View release workflow", workflowUrl)
108+
.write();
96109
97110

0 commit comments

Comments
 (0)