@@ -74,24 +74,37 @@ jobs:
7474 steps :
7575 - uses : liskin/gh-workflow-keepalive@v1
7676
77- # release:
78- # runs-on: ubuntu-latest
79- # if: github.ref_type == 'tag'
80- # needs: tests
81- # env:
82- # GITHUB_LOGIN: dry-bot
83- # GITHUB_TOKEN: ${{secrets.GH_PAT}}
84- # steps:
85- # - uses: actions/checkout@v3
86- # - name: Install package dependencies
87- # run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
88- # - name: Set up Ruby
89- # uses: ruby/setup-ruby@v1
90- # with:
91- # ruby-version: 3.3
92- # - name: Install dependencies
93- # run: gem install ossy --no-document
94- # - name: Trigger release workflow
95- # run: |
96- # tag=$(echo $GITHUB_REF | cut -d / -f 3)
97- # 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}}\"}"
77+ release :
78+ runs-on : ubuntu-latest
79+ if : github.ref_type == 'tag'
80+ needs : tests
81+ steps :
82+ - name : Trigger release workflow
83+ uses : actions/github-script@v7
84+ with :
85+ github-token : ${{ secrets.RELEASE_MACHINE_DISPATCH_TOKEN }}
86+ script : |
87+ const tag = context.ref.replace("refs/tags/", "");
88+ const repo = context.repo.owner + "/" + context.repo.repo;
89+
90+ const tagMessage = await github.rest.git.getTag({
91+ owner: context.repo.owner,
92+ repo: context.repo.repo,
93+ tag_sha: context.sha
94+ }).then(res => res.data.message).catch(() => "");
95+ const announce = /(skip-announce|no-announce)/i.test(tagMessage) ? "false" : "true";
96+
97+ await github.rest.actions.createWorkflowDispatch({
98+ owner: "hanakai-rb",
99+ repo: "release-machine",
100+ workflow_id: "release.yml",
101+ ref: "main",
102+ inputs: { repo, tag, announce }
103+ });
104+
105+ const workflowUrl = "https://github.com/hanakai-rb/release-machine/actions/workflows/release.yml";
106+ await core.summary
107+ .addHeading("Release Triggered")
108+ .addRaw(`Triggered release workflow for <code>${tag}</code>`)
109+ .addLink("View release workflow", workflowUrl)
110+ .write();
0 commit comments