Skip to content

Commit

Permalink
ci: add github-release.yaml (autowarefoundation#210)
Browse files Browse the repository at this point in the history
* ci: add github-release.yaml

Signed-off-by: Kenji Miyake <[email protected]>

* add workflow_dispatch

Signed-off-by: Kenji Miyake <[email protected]>

* add inputs for workflow_dispatch

Signed-off-by: Kenji Miyake <[email protected]>

* support beta branches

Signed-off-by: Kenji Miyake <[email protected]>
  • Loading branch information
kenji-miyake authored Apr 21, 2022
1 parent 5fd3659 commit 6005434
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/github-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: github-release

on:
push:
branches:
- beta/v*
tags:
- v*
workflow_dispatch:
inputs:
beta-branch-or-tag-name:
type: string
required: true

jobs:
github-release:
runs-on: ubuntu-latest
steps:
- name: Set tag name
id: set-tag-name
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
REF_NAME="${{ github.event.inputs.beta-branch-or-tag-name }}"
else
REF_NAME="${{ github.ref_name }}"
fi
echo ::set-output name=ref-name::"$REF_NAME"
echo ::set-output name=tag-name::"${REF_NAME#beta/}"
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ steps.set-tag-name.outputs.ref-name }}

- name: Create a temporary local tag for beta branches
run: |
if [[ "${{ steps.set-tag-name.outputs.ref-name }}" =~ "beta/" ]]; then
git tag "${{ steps.set-tag-name.outputs.tag-name }}"
fi
- name: Run generate-changelog
id: generate-changelog
uses: autowarefoundation/autoware-github-actions/generate-changelog@v1

- name: Remove the temporary local tag for beta branches
run: |
if [[ "${{ steps.set-tag-name.outputs.ref-name }}" =~ "beta/" ]]; then
git tag -d "${{ steps.set-tag-name.outputs.tag-name }}"
fi
- name: Release to GitHub
run: |
gh release create "${{ steps.set-tag-name.outputs.tag-name }}" \
--draft \
--title "Release ${{ steps.set-tag-name.outputs.tag-name }}" \
--notes "$NOTES"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTES: ${{ steps.generate-changelog.outputs.changelog }}

0 comments on commit 6005434

Please sign in to comment.