simplify run (#61) #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: From changelog | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get latest release info | |
id: query-release-info | |
uses: release-flow/keep-a-changelog-action@v3 | |
with: | |
command: query | |
version: latest-or-unreleased | |
- name: Get latest release | |
id: latest-release | |
uses: actions/github-script@v7 | |
if: steps.query-release-info.outputs.version != '[unreleased]' | |
continue-on-error: true | |
with: | |
script: | | |
return await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag: "v${{ steps.query-release-info.outputs.version }}" | |
}) | |
- name: Create release | |
id: create-release | |
uses: actions/github-script@v7 | |
if: steps.latest-release.outcome == 'failure' | |
with: | |
script: | | |
github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: "v${{ steps.query-release-info.outputs.version }}", | |
target_commitish: context.sha, | |
name: "v${{ steps.query-release-info.outputs.version }}", | |
body: `${{ steps.query-release-info.outputs.release-notes }}` | |
}) | |
- name: Tag Submodules | |
uses: actions/github-script@v7 | |
if: steps.create-release.outcome == 'success' | |
with: | |
script: | | |
const modules = [ | |
'otlp', | |
'gcp', | |
'grpc', | |
'http' | |
] | |
for (const module of modules) { | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/"+module+"/v${{ steps.query-release-info.outputs.version }}", | |
sha: context.sha | |
}) | |
} |