|
| 1 | +# Copyright 2020 The Knative Authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# This file is automagically synced here from github.com/knative-sandbox/.github |
| 16 | +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. |
| 17 | + |
| 18 | +name: 'Release Notes' |
| 19 | + |
| 20 | +on: |
| 21 | + workflow_dispatch: |
| 22 | + inputs: |
| 23 | + branch: |
| 24 | + description: 'Branch? (master)' |
| 25 | + required: true |
| 26 | + default: 'master' |
| 27 | + start-sha: |
| 28 | + description: 'Starting SHA? (last tag on branch)' |
| 29 | + end-sha: |
| 30 | + description: 'Ending SHA? (latest HEAD)' |
| 31 | + |
| 32 | +jobs: |
| 33 | + release-notes: |
| 34 | + name: Release Notes |
| 35 | + runs-on: 'ubuntu-latest' |
| 36 | + |
| 37 | + env: |
| 38 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Set up Go |
| 42 | + uses: actions/setup-go@v2 |
| 43 | + with: |
| 44 | + go-version: 1.15.x |
| 45 | + |
| 46 | + - name: Install Dependencies |
| 47 | + run: GO111MODULE=on go get k8s.io/release/cmd/release-notes |
| 48 | + |
| 49 | + - name: Check out code |
| 50 | + uses: actions/checkout@v2 |
| 51 | + with: |
| 52 | + # fetch-depth of 0 indicates all history for all branches and tags. |
| 53 | + fetch-depth: 0 |
| 54 | + |
| 55 | + # Note: Defaults needs to run after we check out the repo. |
| 56 | + - name: Defaults |
| 57 | + run: | |
| 58 | + echo ORG=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}') >> $GITHUB_ENV |
| 59 | + echo REPO=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') >> $GITHUB_ENV |
| 60 | +
|
| 61 | + echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV |
| 62 | +
|
| 63 | + if [[ "${{ github.event.inputs.start-sha }}" != "" ]]; then |
| 64 | + echo "START_SHA=${{ github.event.inputs.start-sha }}" >> $GITHUB_ENV |
| 65 | + else |
| 66 | + # Default Starting SHA (thanks @dprotaso) |
| 67 | + export semver=$(git describe --match "v[0-9]*" --abbrev=0) |
| 68 | + echo "Using ${semver} tag for starting sha." |
| 69 | + echo START_SHA=$(git rev-list -n 1 "${semver}") >> $GITHUB_ENV |
| 70 | + fi |
| 71 | +
|
| 72 | + if [[ "${{ github.event.inputs.end-sha }}" != "" ]]; then |
| 73 | + echo "END_SHA=${{ github.event.inputs.end-sha }}" >> $GITHUB_ENV |
| 74 | + else |
| 75 | + # Default Ending SHA (thanks @dprotaso) |
| 76 | + echo "END_SHA=$(git rev-list -n 1 HEAD)" >> $GITHUB_ENV |
| 77 | + fi |
| 78 | +
|
| 79 | + - name: Generate Notes |
| 80 | + run: | |
| 81 | + # See https://github.com/kubernetes/release/tree/master/cmd/release-notes for options. |
| 82 | + # Note: we are setting env vars in the Defaults step. |
| 83 | + release-notes \ |
| 84 | + --required-author "" \ |
| 85 | + --repo-path "$(pwd)" \ |
| 86 | + --output release-notes.md |
| 87 | +
|
| 88 | + - name: Display Notes |
| 89 | + run: | |
| 90 | + cat release-notes.md |
| 91 | +
|
| 92 | + - name: Archive Release Notes |
| 93 | + uses: actions/upload-artifact@v2 |
| 94 | + with: |
| 95 | + name: release-notes.md |
| 96 | + path: release-notes.md |
0 commit comments